PHP code example of astrotomic / graphql-query-builder

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

    

astrotomic / graphql-query-builder example snippets


use Astrotomic\GraphqlQueryBuilder\Graph;
use Astrotomic\GraphqlQueryBuilder\Query;

Graph::query(
    Query::from('user')
        ->with(['login' => 'Gummibeer'])
        ->select(
            Query::from('sponsorshipsAsMaintainer')
                ->with(['first' => 100, 'after' => 'ABC'])
                ->select(
                    Query::from('pageInfo')->select('hasNextPage', 'endCursor'),
                    Query::from('nodes')->select(
                        Query::from('sponsorEntity')->select(
                            '__typename',
                            Query::for('User')->select('login', 'avatarUrl', 'databaseId', 'name'),
                            Query::for('Organization')->select('login', 'avatarUrl', 'databaseId', 'name'),
                        )
                    )
                )
        )
)