From 3bd02ac30e2dd87e407b7a808b68aac4913e96e4 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun Date: Sun, 24 Mar 2019 18:36:41 +0200 Subject: [PATCH 1/2] GaphQL: Add information about debugging --- _data/toc/graphql.yml | 3 +++ guides/v2.3/graphql/develop/debugging.md | 30 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 guides/v2.3/graphql/develop/debugging.md diff --git a/_data/toc/graphql.yml b/_data/toc/graphql.yml index ad48ff85b6e..c9275b055ba 100644 --- a/_data/toc/graphql.yml +++ b/_data/toc/graphql.yml @@ -24,6 +24,9 @@ pages: - label: Create a custom urlResolver service url: /graphql/develop/create-custom-url-resolver.html + - label: Debugging GraphQL queries + url: /graphql/develop/debugging.html + - label: Exception handling url: /graphql/develop/exceptions.html diff --git a/guides/v2.3/graphql/develop/debugging.md b/guides/v2.3/graphql/develop/debugging.md new file mode 100644 index 00000000000..04180e9f38c --- /dev/null +++ b/guides/v2.3/graphql/develop/debugging.md @@ -0,0 +1,30 @@ +--- +group: graphql +title: Debugging GraphQL queries +--- + +In this section you will find recommendations on how to debug GraphQL requests. + +## Debugging with PHPStorm and Xdebug + +When [using GraphiQL]({{ page.baseurl }}/graphql/index.html#how-to-access-graphql) or any other client for testing GraphQL queries you might need to debug the request processing. +It is possible to use Xdebug for debugging the PHP execution of GraphQL query as well as we do for other HTTP requests. +In order to start debugging you can simply add the additional `?XDEBUG_SESSION_START=PHPSTORM` parameter to the endpoint url. +The following example shows how to establish connection between Xdebug and PHPStorm IDE. + +``` +http:///graphql?XDEBUG_SESSION_START=PHPSTORM +``` + +There is also another possible way to enable Xdebug connection for particular request by setting the corresponding header parameter. + +``` +Cookie: XDEBUG_SESSION=PHPSTORM +``` + +As result Xdebug within the PHP execution attempts to make a connection to an IDE. If the IDE is listening, it will give the instructions to Xdebug about breakpoints etc. + +## Related Topics + +* [GraphQL request headers]({{ page.baseurl }}/graphql/send-request.html) +* [Exception handling]({{ page.baseurl }}/graphql/develop/exceptions.html) From 58ca8a96fc72d79ff2ece8ee0a4eb75475bb8968 Mon Sep 17 00:00:00 2001 From: Dmytro Cheshun Date: Mon, 1 Apr 2019 21:35:57 +0300 Subject: [PATCH 2/2] Debugging GraphQL queries: content improvements --- guides/v2.3/graphql/develop/debugging.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/guides/v2.3/graphql/develop/debugging.md b/guides/v2.3/graphql/develop/debugging.md index 04180e9f38c..705a7197360 100644 --- a/guides/v2.3/graphql/develop/debugging.md +++ b/guides/v2.3/graphql/develop/debugging.md @@ -1,28 +1,30 @@ --- group: graphql title: Debugging GraphQL queries +contributor_name: Atwix +contributor_link: https://www.atwix.com/ --- -In this section you will find recommendations on how to debug GraphQL requests. +This topic provides recommendations on how to debug GraphQL requests. ## Debugging with PHPStorm and Xdebug -When [using GraphiQL]({{ page.baseurl }}/graphql/index.html#how-to-access-graphql) or any other client for testing GraphQL queries you might need to debug the request processing. -It is possible to use Xdebug for debugging the PHP execution of GraphQL query as well as we do for other HTTP requests. -In order to start debugging you can simply add the additional `?XDEBUG_SESSION_START=PHPSTORM` parameter to the endpoint url. -The following example shows how to establish connection between Xdebug and PHPStorm IDE. +When [using GraphiQL]({{ page.baseurl }}/graphql/index.html#how-to-access-graphql) or any other client for testing GraphQL queries, you might need to debug the request processing. +You can use Xdebug for debugging the PHP execution of a GraphQL query just as you would for other HTTP requests. +To start debugging, add the `?XDEBUG_SESSION_START=PHPSTORM` parameter to the endpoint URL. +The following example shows how to establish a connection between Xdebug and PHPStorm IDE. ``` http:///graphql?XDEBUG_SESSION_START=PHPSTORM ``` -There is also another possible way to enable Xdebug connection for particular request by setting the corresponding header parameter. +You can also enable an Xdebug connection for a particular request by setting the corresponding header parameter. ``` Cookie: XDEBUG_SESSION=PHPSTORM ``` -As result Xdebug within the PHP execution attempts to make a connection to an IDE. If the IDE is listening, it will give the instructions to Xdebug about breakpoints etc. +As a result, Xdebug within the PHP execution attempts to make a connection to an IDE. If the IDE is listening, it will give the instructions to Xdebug about breakpoints and other relevant information. ## Related Topics