PHP code example of edwin-luijten / shopify-client

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

    

edwin-luijten / shopify-client example snippets

 php
$client = new \ShopifyClient\Client(new \ShopifyClient\Config($domain, $key, $secret));
$client->orders->get(1);  
$client->orders->all();
$client->orders->all([
    'page' => 2,
]);
  
$client->orders->metafields->all($orderId);
 php
$totalProducts = $client->products->count();
$perPage = 50;
$pages = $totalProducts <= 50 ? 1: round($totalProducts / $perPage);
  
for($i = 0; $i <= $pages; $i++) {
    $products = \ShopifyClient\Request::throttle(function($client, $i) {
        return $client->products->all([
            'page' => $i,
        ]);
    });
}
 php
$config = new \ShopifyClient\Config($domain, $key, $secret, [
  'helloWorld' => \HelloWorldClass::class,
];
$client = new \ShopifyClient\Client($config);