mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 07:49:24 +03:00
Deployed e515964 with MkDocs version: 0.17.3
This commit is contained in:
parent
d201004e2a
commit
5e853ef3ab
@ -200,6 +200,7 @@
|
|||||||
<li><a href="https://github.com/overblog/dataloader-php">DataLoader PHP</a> - as a ready implementation for <a href="../data-fetching/#solving-n1-problem">deferred resolvers</a></li>
|
<li><a href="https://github.com/overblog/dataloader-php">DataLoader PHP</a> - as a ready implementation for <a href="../data-fetching/#solving-n1-problem">deferred resolvers</a></li>
|
||||||
<li><a href="https://github.com/phps-cans/psr7-middleware-graphql">PSR 15 compliant middleware</a> for the Standard Server (experimental)</li>
|
<li><a href="https://github.com/phps-cans/psr7-middleware-graphql">PSR 15 compliant middleware</a> for the Standard Server (experimental)</li>
|
||||||
<li><a href="https://github.com/Ecodev/graphql-upload">GraphQL Uploads</a> for the Standard Server</li>
|
<li><a href="https://github.com/Ecodev/graphql-upload">GraphQL Uploads</a> for the Standard Server</li>
|
||||||
|
<li><a href="https://github.com/vasily-kartashov/graphql-batch-processing">GraphQL Batch Processor</a> - Simple library that provides a builder interface for defining collection, querying, filtering, and post-processing logic of batched data fetches. </li>
|
||||||
</ul>
|
</ul>
|
||||||
<h1 id="general-graphql-tools">General GraphQL Tools</h1>
|
<h1 id="general-graphql-tools">General GraphQL Tools</h1>
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -287,7 +287,7 @@ echo json_encode($output);
|
|||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<p>Our example is finished. Try it by running:</p>
|
<p>Our example is finished. Try it by running:</p>
|
||||||
<pre><code class="sh">php -S localhost:8000 graphql.php
|
<pre><code class="sh">php -S localhost:8080 graphql.php
|
||||||
curl http://localhost:8080 -d '{"query": "query { echo(message: \"Hello World\") }" }'
|
curl http://localhost:8080 -d '{"query": "query { echo(message: \"Hello World\") }" }'
|
||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
|
@ -283,5 +283,5 @@ existing PHP frameworks, add support for Relay, etc.</p>
|
|||||||
|
|
||||||
<!--
|
<!--
|
||||||
MkDocs version : 0.17.3
|
MkDocs version : 0.17.3
|
||||||
Build Date UTC : 2018-04-20 09:39:50
|
Build Date UTC : 2018-07-07 17:31:15
|
||||||
-->
|
-->
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"location": "/getting-started/",
|
"location": "/getting-started/",
|
||||||
"text": "Prerequisites\n\n\nThis documentation assumes your familiarity with GraphQL concepts. If it is not the case - \nfirst learn about GraphQL on \nthe official website\n.\n\n\nInstallation\n\n\nUsing \ncomposer\n, simply run:\n\n\ncomposer require webonyx/graphql-php\n\n\n\n\nUpgrading\n\n\nWe try to keep library releases backwards compatible. But when breaking changes are inevitable \nthey are explained in \nupgrade instructions\n.\n\n\nInstall Tools (optional)\n\n\nWhile it is possible to communicate with GraphQL API using regular HTTP tools it is way \nmore convenient for humans to use \nGraphiQL\n - an in-browser \nIDE for exploring GraphQL APIs.\n\n\nIt provides syntax-highlighting, auto-completion and auto-generated documentation for \nGraphQL API.\n\n\nThe easiest way to use it is to install one of the existing Google Chrome extensions:\n\n\n\n\nChromeiQL\n\n\nGraphiQL Feen\n\n\n\n\nAlternatively, you can follow instructions on \nthe GraphiQL\n\npage and install it locally.\n\n\nHello World\n\n\nLet's create a type system that will be capable to process following simple query:\n\n\nquery {\n echo(message: \"Hello World\")\n}\n\n\n\n\nTo do so we need an object type with field \necho\n:\n\n\n<?php\nuse GraphQL\\Type\\Definition\\ObjectType;\nuse GraphQL\\Type\\Definition\\Type;\n\n$queryType = new ObjectType([\n 'name' => 'Query',\n 'fields' => [\n 'echo' => [\n 'type' => Type::string(),\n 'args' => [\n 'message' => Type::nonNull(Type::string()),\n ],\n 'resolve' => function ($root, $args) {\n return $root['prefix'] . $args['message'];\n }\n ],\n ],\n]);\n\n\n\n\n\n(Note: type definition can be expressed in \ndifferent styles\n, \nbut this example uses \ninline\n style for simplicity)\n\n\nThe interesting piece here is \nresolve\n option of field definition. It is responsible for returning \na value of our field. Values of \nscalar\n fields will be directly included in response while values of \n\ncomposite\n fields (objects, interfaces, unions) will be passed down to nested field resolvers \n(not in this example though).\n\n\nNow when our type is ready, let's create GraphQL endpoint file for it \ngraphql.php\n:\n\n\n<?php\nuse GraphQL\\GraphQL;\nuse GraphQL\\Type\\Schema;\n\n$schema = new Schema([\n 'query' => $queryType\n]);\n\n$rawInput = file_get_contents('php://input');\n$input = json_decode($rawInput, true);\n$query = $input['query'];\n$variableValues = isset($input['variables']) ? $input['variables'] : null;\n\ntry {\n $rootValue = ['prefix' => 'You said: '];\n $result = GraphQL::executeQuery($schema, $query, $rootValue, null, $variableValues);\n $output = $result->toArray();\n} catch (\\Exception $e) {\n $output = [\n 'errors' => [\n [\n 'message' => $e->getMessage()\n ]\n ]\n ];\n}\nheader('Content-Type: application/json');\necho json_encode($output);\n\n\n\n\nOur example is finished. Try it by running:\n\n\nphp -S localhost:8000 graphql.php\ncurl http://localhost:8080 -d '{\"query\": \"query { echo(message: \\\"Hello World\\\") }\" }'\n\n\n\n\nCheck out the full \nsource code\n of this example\nwhich also includes simple mutation.\n\n\nObviously hello world only scratches the surface of what is possible. \nSo check out next example, which is closer to real-world apps.\nOr keep reading about \nschema definition\n.\n\n\nBlog example\n\n\nIt is often easier to start with a full-featured example and then get back to documentation\nfor your own work. \n\n\nCheck out \nBlog example of GraphQL API\n.\nIt is quite close to real-world GraphQL hierarchies. Follow instructions and try it yourself in ~10 minutes.",
|
"text": "Prerequisites\n\n\nThis documentation assumes your familiarity with GraphQL concepts. If it is not the case - \nfirst learn about GraphQL on \nthe official website\n.\n\n\nInstallation\n\n\nUsing \ncomposer\n, simply run:\n\n\ncomposer require webonyx/graphql-php\n\n\n\n\nUpgrading\n\n\nWe try to keep library releases backwards compatible. But when breaking changes are inevitable \nthey are explained in \nupgrade instructions\n.\n\n\nInstall Tools (optional)\n\n\nWhile it is possible to communicate with GraphQL API using regular HTTP tools it is way \nmore convenient for humans to use \nGraphiQL\n - an in-browser \nIDE for exploring GraphQL APIs.\n\n\nIt provides syntax-highlighting, auto-completion and auto-generated documentation for \nGraphQL API.\n\n\nThe easiest way to use it is to install one of the existing Google Chrome extensions:\n\n\n\n\nChromeiQL\n\n\nGraphiQL Feen\n\n\n\n\nAlternatively, you can follow instructions on \nthe GraphiQL\n\npage and install it locally.\n\n\nHello World\n\n\nLet's create a type system that will be capable to process following simple query:\n\n\nquery {\n echo(message: \"Hello World\")\n}\n\n\n\n\nTo do so we need an object type with field \necho\n:\n\n\n<?php\nuse GraphQL\\Type\\Definition\\ObjectType;\nuse GraphQL\\Type\\Definition\\Type;\n\n$queryType = new ObjectType([\n 'name' => 'Query',\n 'fields' => [\n 'echo' => [\n 'type' => Type::string(),\n 'args' => [\n 'message' => Type::nonNull(Type::string()),\n ],\n 'resolve' => function ($root, $args) {\n return $root['prefix'] . $args['message'];\n }\n ],\n ],\n]);\n\n\n\n\n\n(Note: type definition can be expressed in \ndifferent styles\n, \nbut this example uses \ninline\n style for simplicity)\n\n\nThe interesting piece here is \nresolve\n option of field definition. It is responsible for returning \na value of our field. Values of \nscalar\n fields will be directly included in response while values of \n\ncomposite\n fields (objects, interfaces, unions) will be passed down to nested field resolvers \n(not in this example though).\n\n\nNow when our type is ready, let's create GraphQL endpoint file for it \ngraphql.php\n:\n\n\n<?php\nuse GraphQL\\GraphQL;\nuse GraphQL\\Type\\Schema;\n\n$schema = new Schema([\n 'query' => $queryType\n]);\n\n$rawInput = file_get_contents('php://input');\n$input = json_decode($rawInput, true);\n$query = $input['query'];\n$variableValues = isset($input['variables']) ? $input['variables'] : null;\n\ntry {\n $rootValue = ['prefix' => 'You said: '];\n $result = GraphQL::executeQuery($schema, $query, $rootValue, null, $variableValues);\n $output = $result->toArray();\n} catch (\\Exception $e) {\n $output = [\n 'errors' => [\n [\n 'message' => $e->getMessage()\n ]\n ]\n ];\n}\nheader('Content-Type: application/json');\necho json_encode($output);\n\n\n\n\nOur example is finished. Try it by running:\n\n\nphp -S localhost:8080 graphql.php\ncurl http://localhost:8080 -d '{\"query\": \"query { echo(message: \\\"Hello World\\\") }\" }'\n\n\n\n\nCheck out the full \nsource code\n of this example\nwhich also includes simple mutation.\n\n\nObviously hello world only scratches the surface of what is possible. \nSo check out next example, which is closer to real-world apps.\nOr keep reading about \nschema definition\n.\n\n\nBlog example\n\n\nIt is often easier to start with a full-featured example and then get back to documentation\nfor your own work. \n\n\nCheck out \nBlog example of GraphQL API\n.\nIt is quite close to real-world GraphQL hierarchies. Follow instructions and try it yourself in ~10 minutes.",
|
||||||
"title": "Getting Started"
|
"title": "Getting Started"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -52,7 +52,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"location": "/getting-started/#hello-world",
|
"location": "/getting-started/#hello-world",
|
||||||
"text": "Let's create a type system that will be capable to process following simple query: query {\n echo(message: \"Hello World\")\n} To do so we need an object type with field echo : <?php\nuse GraphQL\\Type\\Definition\\ObjectType;\nuse GraphQL\\Type\\Definition\\Type;\n\n$queryType = new ObjectType([\n 'name' => 'Query',\n 'fields' => [\n 'echo' => [\n 'type' => Type::string(),\n 'args' => [\n 'message' => Type::nonNull(Type::string()),\n ],\n 'resolve' => function ($root, $args) {\n return $root['prefix'] . $args['message'];\n }\n ],\n ],\n]); (Note: type definition can be expressed in different styles , \nbut this example uses inline style for simplicity) The interesting piece here is resolve option of field definition. It is responsible for returning \na value of our field. Values of scalar fields will be directly included in response while values of composite fields (objects, interfaces, unions) will be passed down to nested field resolvers \n(not in this example though). Now when our type is ready, let's create GraphQL endpoint file for it graphql.php : <?php\nuse GraphQL\\GraphQL;\nuse GraphQL\\Type\\Schema;\n\n$schema = new Schema([\n 'query' => $queryType\n]);\n\n$rawInput = file_get_contents('php://input');\n$input = json_decode($rawInput, true);\n$query = $input['query'];\n$variableValues = isset($input['variables']) ? $input['variables'] : null;\n\ntry {\n $rootValue = ['prefix' => 'You said: '];\n $result = GraphQL::executeQuery($schema, $query, $rootValue, null, $variableValues);\n $output = $result->toArray();\n} catch (\\Exception $e) {\n $output = [\n 'errors' => [\n [\n 'message' => $e->getMessage()\n ]\n ]\n ];\n}\nheader('Content-Type: application/json');\necho json_encode($output); Our example is finished. Try it by running: php -S localhost:8000 graphql.php\ncurl http://localhost:8080 -d '{\"query\": \"query { echo(message: \\\"Hello World\\\") }\" }' Check out the full source code of this example\nwhich also includes simple mutation. Obviously hello world only scratches the surface of what is possible. \nSo check out next example, which is closer to real-world apps.\nOr keep reading about schema definition .",
|
"text": "Let's create a type system that will be capable to process following simple query: query {\n echo(message: \"Hello World\")\n} To do so we need an object type with field echo : <?php\nuse GraphQL\\Type\\Definition\\ObjectType;\nuse GraphQL\\Type\\Definition\\Type;\n\n$queryType = new ObjectType([\n 'name' => 'Query',\n 'fields' => [\n 'echo' => [\n 'type' => Type::string(),\n 'args' => [\n 'message' => Type::nonNull(Type::string()),\n ],\n 'resolve' => function ($root, $args) {\n return $root['prefix'] . $args['message'];\n }\n ],\n ],\n]); (Note: type definition can be expressed in different styles , \nbut this example uses inline style for simplicity) The interesting piece here is resolve option of field definition. It is responsible for returning \na value of our field. Values of scalar fields will be directly included in response while values of composite fields (objects, interfaces, unions) will be passed down to nested field resolvers \n(not in this example though). Now when our type is ready, let's create GraphQL endpoint file for it graphql.php : <?php\nuse GraphQL\\GraphQL;\nuse GraphQL\\Type\\Schema;\n\n$schema = new Schema([\n 'query' => $queryType\n]);\n\n$rawInput = file_get_contents('php://input');\n$input = json_decode($rawInput, true);\n$query = $input['query'];\n$variableValues = isset($input['variables']) ? $input['variables'] : null;\n\ntry {\n $rootValue = ['prefix' => 'You said: '];\n $result = GraphQL::executeQuery($schema, $query, $rootValue, null, $variableValues);\n $output = $result->toArray();\n} catch (\\Exception $e) {\n $output = [\n 'errors' => [\n [\n 'message' => $e->getMessage()\n ]\n ]\n ];\n}\nheader('Content-Type: application/json');\necho json_encode($output); Our example is finished. Try it by running: php -S localhost:8080 graphql.php\ncurl http://localhost:8080 -d '{\"query\": \"query { echo(message: \\\"Hello World\\\") }\" }' Check out the full source code of this example\nwhich also includes simple mutation. Obviously hello world only scratches the surface of what is possible. \nSo check out next example, which is closer to real-world apps.\nOr keep reading about schema definition .",
|
||||||
"title": "Hello World"
|
"title": "Hello World"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -62,7 +62,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"location": "/complementary-tools/",
|
"location": "/complementary-tools/",
|
||||||
"text": "Integrations\n\n\n\n\nIntegration with Relay\n\n\nIntegration with Laravel 5\n + \nRelay Helpers for Laravel\n + \nNuwave Lighthouse\n\n\nSymfony Bundle\n by Overblog\n\n\nOut of the box integration with any PSR-7 compatible framework (like \nSlim\n or \nZend Expressive\n) via \nStandard Server\n\n\n\n\nGraphQL PHP Tools\n\n\n\n\nDefine types with Doctrine ORM annotations (\nfor PHP7.1\n, for \nearlier PHP versions\n)\n\n\nDataLoader PHP\n - as a ready implementation for \ndeferred resolvers\n\n\nPSR 15 compliant middleware\n for the Standard Server (experimental)\n\n\nGraphQL Uploads\n for the Standard Server\n\n\n\n\nGeneral GraphQL Tools\n\n\n\n\nGraphiQL\n - An in-browser IDE for exploring GraphQL\n\n\nChromeiQL\n\n or \nGraphiQL Feen\n -\n GraphiQL as Google Chrome extension",
|
"text": "Integrations\n\n\n\n\nIntegration with Relay\n\n\nIntegration with Laravel 5\n + \nRelay Helpers for Laravel\n + \nNuwave Lighthouse\n\n\nSymfony Bundle\n by Overblog\n\n\nOut of the box integration with any PSR-7 compatible framework (like \nSlim\n or \nZend Expressive\n) via \nStandard Server\n\n\n\n\nGraphQL PHP Tools\n\n\n\n\nDefine types with Doctrine ORM annotations (\nfor PHP7.1\n, for \nearlier PHP versions\n)\n\n\nDataLoader PHP\n - as a ready implementation for \ndeferred resolvers\n\n\nPSR 15 compliant middleware\n for the Standard Server (experimental)\n\n\nGraphQL Uploads\n for the Standard Server\n\n\nGraphQL Batch Processor\n - Simple library that provides a builder interface for defining collection, querying, filtering, and post-processing logic of batched data fetches. \n\n\n\n\nGeneral GraphQL Tools\n\n\n\n\nGraphiQL\n - An in-browser IDE for exploring GraphQL\n\n\nChromeiQL\n\n or \nGraphiQL Feen\n -\n GraphiQL as Google Chrome extension",
|
||||||
"title": "Complementary Tools"
|
"title": "Complementary Tools"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -72,7 +72,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"location": "/complementary-tools/#graphql-php-tools",
|
"location": "/complementary-tools/#graphql-php-tools",
|
||||||
"text": "Define types with Doctrine ORM annotations ( for PHP7.1 , for earlier PHP versions ) DataLoader PHP - as a ready implementation for deferred resolvers PSR 15 compliant middleware for the Standard Server (experimental) GraphQL Uploads for the Standard Server",
|
"text": "Define types with Doctrine ORM annotations ( for PHP7.1 , for earlier PHP versions ) DataLoader PHP - as a ready implementation for deferred resolvers PSR 15 compliant middleware for the Standard Server (experimental) GraphQL Uploads for the Standard Server GraphQL Batch Processor - Simple library that provides a builder interface for defining collection, querying, filtering, and post-processing logic of batched data fetches.",
|
||||||
"title": "GraphQL PHP Tools"
|
"title": "GraphQL PHP Tools"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -282,7 +282,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"location": "/type-system/directives/",
|
"location": "/type-system/directives/",
|
||||||
"text": "Built-in directives\n\n\nThe directive is a way for a client to give GraphQL server additional context and hints on how to execute\nthe query. The directive can be attached to a field or fragment and can affect the execution of the \nquery in any way the server desires.\n\n\nGraphQL specification includes two built-in directives:\n\n\n\n\n@include(if: Boolean)\n Only include this field or fragment in the result if the argument is \ntrue\n \n\n\n@skip(if: Boolean)\n Skip this field or fragment if the argument is \ntrue\n\n\n\n\nFor example:\n\n\nquery Hero($episode: Episode, $withFriends: Boolean!) {\n hero(episode: $episode) {\n name\n friends @include(if: $withFriends) {\n name\n }\n }\n}\n\n\n\n\nHere if \n$withFriends\n variable is set to \nfalse\n - friends section will be ignored and excluded \nfrom the response. Important implementation detail: those fields will never be executed \n(not just removed from response after execution).\n\n\nCustom directives\n\n\ngraphql-php\n supports custom directives even though their presence does not affect the execution of fields.\nBut you can use \nGraphQL\\Type\\Definition\\ResolveInfo\n \nin field resolvers to modify the output depending on those directives or perform statistics collection.\n\n\nOther use case is your own query validation rules relying on custom directives.\n\n\nIn \ngraphql-php\n custom directive is an instance of \nGraphQL\\Type\\Definition\\Directive\n\n(or one of its subclasses) which accepts an array of following options:\n\n\n<?php\nuse GraphQL\\Language\\DirectiveLocation;\nuse GraphQL\\Type\\Definition\\Type;\nuse GraphQL\\Type\\Definition\\Directive;\nuse GraphQL\\Type\\Definition\\FieldArgument;\n\n$trackDirective = new Directive([\n 'name' => 'track',\n 'description' => 'Instruction to record usage of the field by client',\n 'locations' => [\n DirectiveLocation::FIELD,\n ],\n 'args' => [\n new FieldArgument([\n 'name' => 'details',\n 'type' => Type::string(),\n 'description' => 'String with additional details of field usage scenario',\n 'defaultValue' => ''\n ])\n ]\n]);\n\n\n\n\nSee possible directive locations in \n\nGraphQL\\Type\\Definition\\DirectiveLocation\n.",
|
"text": "Built-in directives\n\n\nThe directive is a way for a client to give GraphQL server additional context and hints on how to execute\nthe query. The directive can be attached to a field or fragment and can affect the execution of the \nquery in any way the server desires.\n\n\nGraphQL specification includes two built-in directives:\n\n\n\n\n@include(if: Boolean)\n Only include this field or fragment in the result if the argument is \ntrue\n \n\n\n@skip(if: Boolean)\n Skip this field or fragment if the argument is \ntrue\n\n\n\n\nFor example:\n\n\nquery Hero($episode: Episode, $withFriends: Boolean!) {\n hero(episode: $episode) {\n name\n friends @include(if: $withFriends) {\n name\n }\n }\n}\n\n\n\n\nHere if \n$withFriends\n variable is set to \nfalse\n - friends section will be ignored and excluded \nfrom the response. Important implementation detail: those fields will never be executed \n(not just removed from response after execution).\n\n\nCustom directives\n\n\ngraphql-php\n supports custom directives even though their presence does not affect the execution of fields.\nBut you can use \nGraphQL\\Type\\Definition\\ResolveInfo\n \nin field resolvers to modify the output depending on those directives or perform statistics collection.\n\n\nOther use case is your own query validation rules relying on custom directives.\n\n\nIn \ngraphql-php\n custom directive is an instance of \nGraphQL\\Type\\Definition\\Directive\n\n(or one of its subclasses) which accepts an array of following options:\n\n\n<?php\nuse GraphQL\\Language\\DirectiveLocation;\nuse GraphQL\\Type\\Definition\\Type;\nuse GraphQL\\Type\\Definition\\Directive;\nuse GraphQL\\Type\\Definition\\FieldArgument;\n\n$trackDirective = new Directive([\n 'name' => 'track',\n 'description' => 'Instruction to record usage of the field by client',\n 'locations' => [\n DirectiveLocation::FIELD,\n ],\n 'args' => [\n new FieldArgument([\n 'name' => 'details',\n 'type' => Type::string(),\n 'description' => 'String with additional details of field usage scenario',\n 'defaultValue' => ''\n ])\n ]\n]);\n\n\n\n\nSee possible directive locations in \n\nGraphQL\\Language\\DirectiveLocation\n.",
|
||||||
"title": "Directives"
|
"title": "Directives"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -292,7 +292,7 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"location": "/type-system/directives/#custom-directives",
|
"location": "/type-system/directives/#custom-directives",
|
||||||
"text": "graphql-php supports custom directives even though their presence does not affect the execution of fields.\nBut you can use GraphQL\\Type\\Definition\\ResolveInfo \nin field resolvers to modify the output depending on those directives or perform statistics collection. Other use case is your own query validation rules relying on custom directives. In graphql-php custom directive is an instance of GraphQL\\Type\\Definition\\Directive \n(or one of its subclasses) which accepts an array of following options: <?php\nuse GraphQL\\Language\\DirectiveLocation;\nuse GraphQL\\Type\\Definition\\Type;\nuse GraphQL\\Type\\Definition\\Directive;\nuse GraphQL\\Type\\Definition\\FieldArgument;\n\n$trackDirective = new Directive([\n 'name' => 'track',\n 'description' => 'Instruction to record usage of the field by client',\n 'locations' => [\n DirectiveLocation::FIELD,\n ],\n 'args' => [\n new FieldArgument([\n 'name' => 'details',\n 'type' => Type::string(),\n 'description' => 'String with additional details of field usage scenario',\n 'defaultValue' => ''\n ])\n ]\n]); See possible directive locations in GraphQL\\Type\\Definition\\DirectiveLocation .",
|
"text": "graphql-php supports custom directives even though their presence does not affect the execution of fields.\nBut you can use GraphQL\\Type\\Definition\\ResolveInfo \nin field resolvers to modify the output depending on those directives or perform statistics collection. Other use case is your own query validation rules relying on custom directives. In graphql-php custom directive is an instance of GraphQL\\Type\\Definition\\Directive \n(or one of its subclasses) which accepts an array of following options: <?php\nuse GraphQL\\Language\\DirectiveLocation;\nuse GraphQL\\Type\\Definition\\Type;\nuse GraphQL\\Type\\Definition\\Directive;\nuse GraphQL\\Type\\Definition\\FieldArgument;\n\n$trackDirective = new Directive([\n 'name' => 'track',\n 'description' => 'Instruction to record usage of the field by client',\n 'locations' => [\n DirectiveLocation::FIELD,\n ],\n 'args' => [\n new FieldArgument([\n 'name' => 'details',\n 'type' => Type::string(),\n 'description' => 'String with additional details of field usage scenario',\n 'defaultValue' => ''\n ])\n ]\n]); See possible directive locations in GraphQL\\Language\\DirectiveLocation .",
|
||||||
"title": "Custom directives"
|
"title": "Custom directives"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
40
sitemap.xml
40
sitemap.xml
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/</loc>
|
<loc>/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/getting-started/</loc>
|
<loc>/getting-started/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -20,7 +20,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/complementary-tools/</loc>
|
<loc>/complementary-tools/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -29,67 +29,67 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/</loc>
|
<loc>/type-system/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/object-types/</loc>
|
<loc>/type-system/object-types/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/scalar-types/</loc>
|
<loc>/type-system/scalar-types/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/enum-types/</loc>
|
<loc>/type-system/enum-types/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/lists-and-nonnulls/</loc>
|
<loc>/type-system/lists-and-nonnulls/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/interfaces/</loc>
|
<loc>/type-system/interfaces/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/unions/</loc>
|
<loc>/type-system/unions/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/input-types/</loc>
|
<loc>/type-system/input-types/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/directives/</loc>
|
<loc>/type-system/directives/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/schema/</loc>
|
<loc>/type-system/schema/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/type-system/type-language/</loc>
|
<loc>/type-system/type-language/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -98,7 +98,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/executing-queries/</loc>
|
<loc>/executing-queries/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -106,7 +106,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/data-fetching/</loc>
|
<loc>/data-fetching/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -114,7 +114,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/error-handling/</loc>
|
<loc>/error-handling/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -122,7 +122,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/security/</loc>
|
<loc>/security/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -130,7 +130,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/how-it-works/</loc>
|
<loc>/how-it-works/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
@ -138,7 +138,7 @@
|
|||||||
|
|
||||||
<url>
|
<url>
|
||||||
<loc>/reference/</loc>
|
<loc>/reference/</loc>
|
||||||
<lastmod>2018-04-20</lastmod>
|
<lastmod>2018-07-08</lastmod>
|
||||||
<changefreq>daily</changefreq>
|
<changefreq>daily</changefreq>
|
||||||
</url>
|
</url>
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ $trackDirective = new Directive([
|
|||||||
</code></pre>
|
</code></pre>
|
||||||
|
|
||||||
<p>See possible directive locations in
|
<p>See possible directive locations in
|
||||||
<a href="../../reference/#graphqltypedefinitiondirectivelocation"><code>GraphQL\Type\Definition\DirectiveLocation</code></a>.</p>
|
<a href="../../reference/#graphqllanguagedirectivelocation"><code>GraphQL\Language\DirectiveLocation</code></a>.</p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user