This package provides a client to communicate with the Shopify api.
Via Composer
$ composer require edwin-luijten/shopify-client
Read the following documentation: https://help.shopify.com/api/getting-started
$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);
Throttle request to prevent bucket overflow:
$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,
]);
});
}
Check https://github.com/Edwin-Luijten/shopify-client/tree/develop/src/Resource for how to create your own resource.
$config = new \ShopifyClient\Config($domain, $key, $secret, [
'helloWorld' => \HelloWorldClass::class,
];
$client = new \ShopifyClient\Client($config);
- Abandoned checkouts
- Article (Accessible trough blogs)
- Blog
- CarrierService
- Checkout
- Collect
- CollectionListing
- Comment
- Country
- CustomCollection
- Customer
- CustomerAddress (Accessible trough customers)
- CustomerSavedSearch
- DiscountCode (Accessible trough priceRules)
- DraftOrder
- Event
- Fulfillment
- FulfillmentEvent
- FulfillmentService
- Gift Card (Shopify Plus)
- Location
- Marketing Event
- Metafield (products, variants, orders, blogs, articles)
- Multipass (Shopify Plus)
- Order
- Order Risks (Accessible trough orders)
- Page
- Policy
- PriceRule
- Product
- Product Image (Accessible trough products)
- Product Variant (Accessible trough products)
- ProductListing
- Province (Accessible trough countries)
- RecurringApplicationCharge
- Redirect
- Refund
- Report
- ResourceFeedback
- ScriptTag
- Shipping Zone
- Shop
- SmartCollection
- Storefront Access Token
- Theme
- Transaction
- UsageCharge
- User (Shopify Plus)
- Webhook
- ShopifyQL
Set some environment variables first:
- SHOPIFY_DOMAIN
- SHOPIFY_KEY
- SHOPIFY_SECRET
- SHOPIFY_RATE_LIMIT
- SHOPIFY_PRODUCT_VARIANT_ID
$ ./vendor/bin/phpunit
Please see CONTRIBUTING for details.
If you discover any security related issues, please email :author_email instead of using the issue tracker.
The MIT License (MIT). Please see License File for more information.