PHP code example of mcarrowsmith-packages / shopify-graphql-client
1. Go to this page and download the library: Download mcarrowsmith-packages/shopify-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/ */
mcarrowsmith-packages / shopify-graphql-client example snippets
use \McArrowsmithPackages\ShopifyGraphQLClient\ClientFactory;
$query = <<<'QUERY'
query {
shop {
name
}
}
QUERY;
$factory = ClientFactory::make('example.myshopify.com', '<API-TOKEN>', '2022-07');
try {
$factory->request($query);
} catch (\Throwable $t) {
echo $t->getMessage() . PHP_EOL;
}