PHP code example of darthsoup / php-graphql-client
1. Go to this page and download the library: Download darthsoup/php-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/ */
darthsoup / php-graphql-client example snippets
$gql = (new Query('companies'))
->setSelectionSet(
[
'name',
'serialNumber'
]
);
$gql = (new Query())
->setSelectionSet(
[
(new Query('companies'))
->setSelectionSet(
[
'name',
'serialNumber'
]
)
]
);
$gql = (new Query())
->setSelectionSet(
[
(new Query('companies'))
->setSelectionSet(
[
'name',
'serialNumber'
]
),
(new Query('countries'))
->setSelectionSet(
[
'name',
'code',
]
)
]
);
$gql = (new Query('companies'))
->setSelectionSet(
[
'name',
'serialNumber',
(new Query('branches'))
->setSelectionSet(
[
'address',
(new Query('contracts'))
->setSelectionSet(['date'])
]
)
]
);
$gql = <<<QUERY
query {
pokemon(name: "Pikachu") {
id
number
name
attacks {
special {
name
type
damage
}
}
}
}
QUERY;
$results = $client->runRawQuery($gql);
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.