Package Data | |
---|---|
Maintainer Username: | dan |
Maintainer Contact: | danrichardsri@gmail.com (Dan Richards) |
Package Create Date: | 2017-07-19 |
Package Last Update: | 2024-04-26 |
Home Page: | |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-11-23 03:06:16 |
Package Statistics | |
---|---|
Total Downloads: | 25,244 |
Monthly Downloads: | 391 |
Daily Downloads: | 25 |
Total Stars: | 23 |
Total Watchers: | 6 |
Total Forks: | 9 |
Total Open Issues: | 1 |
An object-oriented approach towards using the Shopify API. This repos is a work-in-progress and not production ready.
Please note: the old version (v0.9) using Guzzle 3.9 is maintained here
$ composer require dan/shopify-api v1.*
// Assumes setup of client with access token.
$api = Dan\Shopify\Shopify::make($shop, $token);
$api->orders->find($order_id = 123); // returns Dan\Shopify/Models/Order
// Alternatively, we may call methods on the API object.
$api->orders->get([], $order_id = 123); // returns array
See Facade usages for other methods available.
In your config/app.php
providers
array:Dan\Shopify\Integrations\Laravel\ShopifyServiceProvider::class,
aliases
array:'Shopify' => Dan\Shopify\Integrations\Laravel\ShopifyFacade::class,
.env
SHOPIFY_DOMAIN=your-shop-name.myshopify.com
SHOPIFY_TOKEN=your-token-here
Dan\Shopify\Shopify
It will be instantiated with your shop and token you setup in
config/shopify.php
or
Shopify::getAppInstallResponse(
'your_app_client_id',
'your_app_client_secret',
'shop_from_request',
'code_from_request'
);
// returns (object) ['access_token' => '...', 'scopes' => '...']
Dan\Shopify\Util::validAppHmac(
'hmac_from_request',
'your_app_client_secret',
['shop' => '...', 'timestamp' => '...', ...]
);
Dan\Shopify\Util::validWebhookHmac(
'hmac_from_request',
'your_app_client_secret',
file_get_contents('php://input')
);
MIT.