Download the PHP package donutdan4114/shopify without Composer
On this page you can find all versions of the php package donutdan4114/shopify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download donutdan4114/shopify
More information about donutdan4114/shopify
Files in donutdan4114/shopify
Package shopify
Short Description Shopify PHP SDK to interact with the Shopify API.
License MIT
Informations about the package shopify
Shopify PHP SDK
A simple Shopify PHP SDK for private apps to easily interact with the Shopify API.
Shopify API Documentation | Packagist | Build Status
Features include:
- ability to easily GET, PUT, POST and DELETE resources
- process and validate incoming webhooks
- automatic rate limiting to avoid API calls from erroring
Setup/Installation
Depends on guzzlehttp/guzzle.
Get via Composer...
Get a stable release:
composer require donutdan4114/shopify:v2020.01.*
Get the latest unstable version:
composer require donutdan4114/shopify:dev-master
API Versions
This package now includes versions that match Shopify's API version naming convention.
Version format is vYYYY.MM.V#
where increasing the V#
will not break backwards compatibility.
Check the changelog in releases to see what changes may break backwards compatability.
New in Version 2020.01
This update utilizes the new pagination system in the Shopify API. The page
query param is no longer supported.
The "resource pager" which automatically loops through pages will handle this change automatically for you.
If you have custom code using the page
param you'll need to update your code like:
Private & Public Apps
You can use this library for private or public app creation. Using private apps is easier because their is no access_token
required.
However, if you want to create a publicly accessible app, you must use the Public App system.
Private App
Simply instantiate a private app with the shop_domain
, api_key
, password
, and shared_secret
.
Public App
You must first setup a public app. View documentation. You need an authorization URL.
At this point, the user is taken to their store to authorize the application to use their information. If the user accepts, they are taken to the redirect URL.
It's at this point, in dashboard.php you could starting doing API request by setting the access_token
.
Methods
GET
Get resource information from the API.
$result
is a JSON decoded stdClass
:
Get product IDs by passing query params:
POST
Create new content with a POST request.
PUT
Update existing content with a given ID.
DELETE
Easily delete resources with a given ID.
Simple Wrapper
To make it easier to work with common API resources, there are several short-hand functions.
Parsing Incoming Webhooks
If you have a route setup on your site to accept incoming Shopify webhooks, you can easily parse the data and validate the contents. There are two ways to validate webhooks: manually, or using the client.
Error Handling
Any API error will throw an instance of Shopify\ClientException
.
API Limit Handling
This class can handle API rate limiting for you based on Shopify's "leaky bucket" algorithm. It will automatically slow down requests to not hit the rate limiter. You can disabled this with:
You can put in your own rate limiting logic using the $client->getCallLimit()
and $client->callLimitReached()
methods.
Testing
Tests can be run with phpunit
.
Since the tests actually modify the connected store, you must explicitly allow tests to be run by settings SHOPIFY_ALLOW_TESTS
environment variable to TRUE
.
Without that, you will be get a message like: