diff --git a/complementary-tools/index.html b/complementary-tools/index.html index 1819898..500e676 100755 --- a/complementary-tools/index.html +++ b/complementary-tools/index.html @@ -200,6 +200,7 @@
Our example is finished. Try it by running:
-php -S localhost:8000 graphql.php
+php -S localhost:8080 graphql.php
curl http://localhost:8080 -d '{"query": "query { echo(message: \"Hello World\") }" }'
diff --git a/index.html b/index.html
index 2c5a4a4..cb26884 100755
--- a/index.html
+++ b/index.html
@@ -283,5 +283,5 @@ existing PHP frameworks, add support for Relay, etc.
diff --git a/search/search_index.json b/search/search_index.json
index b2cfbc3..c88f406 100755
--- a/search/search_index.json
+++ b/search/search_index.json
@@ -27,7 +27,7 @@
},
{
"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 '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 $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 '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 $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"
},
{
@@ -52,7 +52,7 @@
},
{
"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 : '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 : $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 : '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 : $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"
},
{
@@ -62,7 +62,7 @@
},
{
"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"
},
{
@@ -72,7 +72,7 @@
},
{
"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"
},
{
@@ -282,7 +282,7 @@
},
{
"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 '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 '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"
},
{
@@ -292,7 +292,7 @@
},
{
"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: '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: '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"
},
{
diff --git a/sitemap.xml b/sitemap.xml
index 70594e9..3ada949 100755
--- a/sitemap.xml
+++ b/sitemap.xml
@@ -4,7 +4,7 @@
/
- 2018-04-20
+ 2018-07-08
daily
@@ -12,7 +12,7 @@
/getting-started/
- 2018-04-20
+ 2018-07-08
daily
@@ -20,7 +20,7 @@
/complementary-tools/
- 2018-04-20
+ 2018-07-08
daily
@@ -29,67 +29,67 @@
/type-system/
- 2018-04-20
+ 2018-07-08
daily
/type-system/object-types/
- 2018-04-20
+ 2018-07-08
daily
/type-system/scalar-types/
- 2018-04-20
+ 2018-07-08
daily
/type-system/enum-types/
- 2018-04-20
+ 2018-07-08
daily
/type-system/lists-and-nonnulls/
- 2018-04-20
+ 2018-07-08
daily
/type-system/interfaces/
- 2018-04-20
+ 2018-07-08
daily
/type-system/unions/
- 2018-04-20
+ 2018-07-08
daily
/type-system/input-types/
- 2018-04-20
+ 2018-07-08
daily
/type-system/directives/
- 2018-04-20
+ 2018-07-08
daily
/type-system/schema/
- 2018-04-20
+ 2018-07-08
daily
/type-system/type-language/
- 2018-04-20
+ 2018-07-08
daily
@@ -98,7 +98,7 @@
/executing-queries/
- 2018-04-20
+ 2018-07-08
daily
@@ -106,7 +106,7 @@
/data-fetching/
- 2018-04-20
+ 2018-07-08
daily
@@ -114,7 +114,7 @@
/error-handling/
- 2018-04-20
+ 2018-07-08
daily
@@ -122,7 +122,7 @@
/security/
- 2018-04-20
+ 2018-07-08
daily
@@ -130,7 +130,7 @@
/how-it-works/
- 2018-04-20
+ 2018-07-08
daily
@@ -138,7 +138,7 @@
/reference/
- 2018-04-20
+ 2018-07-08
daily
diff --git a/type-system/directives/index.html b/type-system/directives/index.html
index cd35218..bc61bf8 100755
--- a/type-system/directives/index.html
+++ b/type-system/directives/index.html
@@ -242,7 +242,7 @@ $trackDirective = new Directive([
See possible directive locations in
-GraphQL\Type\Definition\DirectiveLocation
.
GraphQL\Language\DirectiveLocation
.