PHP code example of evilfreelancer / simplegqlient
1. Go to this page and download the library: Download evilfreelancer/simplegqlient 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/ */
evilfreelancer / simplegqlient example snippets
$githubToken = 'xxx';
$client = new \SimpleGQLient\Client('https://api.github.com/graphql', [
'Authorization' => 'Bearer ' . $githubToken,
'Accept' => 'application/vnd.github.hawkgirl-preview+json,',
]);
$response = $client->graphQL(/** @lang GraphQL */ '
{
user(login: "evilfreelancer") {
repositories(ownerAffiliations: OWNER, isFork: false, first: 100) {
nodes {
name
languages(first: 10, orderBy: { field: SIZE, direction: DESC }) {
edges {
size
node {
color
name
}
}
}
}
}
}
}
');
// \Psr\Http\Message\ResponseInterface in response
$output = $response->getBody()->getContents();
var_dump($output);