1. Go to this page and download the library: Download 0length/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/ */
0length / graphql-client example snippets
\Zerolength\Graphql\GraphqlServiceProvider::class
namespace App\Graphql\Queries;
use Zerolength\Graphql\Entities\GraphqlQueries;
use App\Models\User;
class CSQueries extends GraphqlQueries
{
/**
* Generate privately subscription session key for User.
*/
public function createSession(User $user)
{
$this->setPayload(
__FUNCTION__,
[
'data' => $user
],
'
query ' . __FUNCTION__ . 'Operation($data: SessionDataInput!){
' . __FUNCTION__ . '(data: $data)
}
'
);
return $this->execute();
}
}
$sessionCreationResponse = (new CSQueries())->createSession($user);
php artisan vendor:publish --tag=config
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.