1. Go to this page and download the library: Download x-graphql/http-schema library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
x-graphql / http-schema example snippets
use GraphQL\GraphQL;
use XGraphQL\HttpSchema\HttpDelegator;
use XGraphQL\HttpSchema\HttpSchemaFactory;
$delegator = new HttpDelegator('https://countries.trevorblades.com/');
$schema = HttpSchemaFactory::createFromSDL(
$delegator,
<<<'SDL'
type Query {
countries: [Country!]!
}
type Country {
name: String!
}
SDL
);
$result = GraphQL::executeQuery($schema, 'query { countries { name } }');
var_dump($result->toArray());
use GraphQL\GraphQL;
use XGraphQL\HttpSchema\HttpDelegator;
use XGraphQL\HttpSchema\HttpSchemaFactory;
$delegator = new HttpDelegator('https://countries.trevorblades.com/');
$schema = HttpSchemaFactory::createFromIntrospectionQuery($delegator);
$result = GraphQL::executeQuery($schema, 'query { countries { name } }');
var_dump($result->toArray());
use XGraphQL\HttpSchema\HttpDelegator;
use XGraphQL\HttpSchema\HttpSchemaFactory;
/// $psr16Cache = ....
$delegator = new HttpDelegator('https://countries.trevorblades.com/');
$schemaFromSDL = HttpSchemaFactory::createFromSDL($delegator, /// $sdl, $psr16Cache);
$schemaFromIntrospection = HttpSchemaFactory::createFromIntrospectionQuery($delegator, /// $psr16Cache);
/// ........
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.