1. Go to this page and download the library: Download preprio/php-graphql-sdk 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/ */
preprio / php-graphql-sdk example snippets
use Preprio\Prepr;
$apiRequest = new Prepr('{ENDPOINT_URL}');
$apiRequest
->rawQuery('{
Posts( limit : 30 ) {
items {
_id
_slug
title
}
}
}')
->request();
print_r($apiRequest->getResponse());
use Preprio\Prepr;
$apiRequest = new Prepr('{ENDPOINT_URL}');
$apiRequest
->query('query_file.graphql')
->request();
print_r($apiRequest->getResponse());
use Preprio\Prepr;
$apiRequest = new Prepr('{ENDPOINT_URL}');
$apiRequest
->headers([
'Prepr-Customer-Id' => 'your-customers-session-or-customer-id'
])
->request();
print_r($apiRequest->getResponse());
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.