PHP code example of convenia / graphql-client

1. Go to this page and download the library: Download convenia/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/ */

    

convenia / graphql-client example snippets



use Convenia\GraphQLClient\Mutation;

class UpdateUserMutation extends Mutation
{
    protected $queryName = 'createUser';

    protected $outputParams = [
        'id',
        'name',
        'last_name'
    ];
}


class User
{
    protected $client = new GuzzleHttp\Client();

    protected $baseUrl = 'http://www.mygraphqlapi/v1/graphql'

    public static function create($userId, $data, $returnParams = [])
    {
        $mutation = new UpdateUserMutation($this->baseUrl);

        $mutation->update($userId, $data, $returnParams);
    }
}