PHP code example of jasonrgd / graphql-client
1. Go to this page and download the library: Download jasonrgd/graphql-client 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/ */
jasonrgd / graphql-client example snippets
php
$client = \Softonic\GraphQL\ClientBuilder::build('https://catalog.swarm.pub.softonic.one/graphql');
$query = <<<'QUERY'
query GetFooBar($idFoo: String, $idBar: String) {
foo(id: $idFoo) {
id_foo
bar (id: $idBar) {
id_bar
}
}
}
QUERY;
$variables = [
'idFoo' => 'foo',
'idBar' => 'bar',
];
$response = $client->query($query, $variables);