Link to WPGraphQL on Github
Link to WPGraphQL on WordPress.org

Using GraphQL Fragments in PHP

You can execute GraphQL queries in PHP. In this case, we even show using a GraphQL Fragment.

Executing this code leads to the following output:

PHP output of executing Graphql

Additionally, if you were to define your fragment in another file, such as the file that is rendering the data, you can define fragments as variables and concatenate them like so: