PHP code example of cronqvist / graphql-client

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

    

cronqvist / graphql-client example snippets


// Easiest is to use the 'throwFirstError' method to throw an exception if any GraphQL error was returned:
$response->throwFirstError();

// or...

// Check if any errors exist
if($response->hasErrors()) {
    
    // Dump all errors
    var_dump($response->errors());
    
    // Or dump only the first error
    var_dump($response->firstError();
}