Download the PHP package shopifychamp/shopify-api-php-sdk without Composer
On this page you can find all versions of the php package shopifychamp/shopify-api-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shopifychamp/shopify-api-php-sdk
More information about shopifychamp/shopify-api-php-sdk
Files in shopifychamp/shopify-api-php-sdk
Package shopify-api-php-sdk
Short Description PHP SDK to connect with Shopify Custom, Public and Private App using REST Api and Graphql
License MIT
Homepage https://github.com/shopifychamp/shopify-api-php-sdk
Informations about the package shopify-api-php-sdk
SHOPIFY API PHP SDK
PHP SDK helps to connect with shopify Public App and Private App using REST Api and Graphql.
- Call GET, POST, PUT and DELETE RestApi method.
- Process GraphQL Admin API for Query root and Mutations.
- Queryroot is used to get resources and mutations is used to update resources (products/orders/customers).
- Automatic manage Shopify API rate limits.
- Compatible with Cursor Based Pagination to resource with pagination.
Installation
- Install package with Composer
Requirements
-
For Api call need Guzzle. The recommended way to install Guzzle is through Composer.
- To prepare graphql query with GraphQL query builder.
Getting started
Initialize the client
1. For Private App
- To create instance of
Client
class, needshop
,api_key
,password
of private app,api_params
is an array to pass api version withYYYY-DD/unstable
format otherwise, Api latest version will be assigned.
2. For Public App
-
To create instance of
Client
class, needshop
,api_key
,api_secret_key
of public app. - Prepare authorise url to install public app and get
access_token
to store in database or session for future api call.
Call REST Api
-
Get Products with limit 250 with
call()
function -
Get products of next page with page_info
Check next page available with
hasNextPage()
function:Check if previous page available with
hasPrevPage()
function:
Call GraphQL Api
-
Get product title, description with id by
query()
functionNote:
-
For single attribute and field
- For multiple attributes and fields
Prepare query:
Call GraphQL with
callGraphql()
function: -
-
Create customer with graphql
mutation()
functionPrepare mutation:
Call GraphQL qith
callGraphql()
function: -
Cursor Pagination with graphQL
Prepare Query and
$reserve_query
variable to store query for next page call:Call GraphQL qith
callGraphql()
function. AndIf you continue repeating this step with the cursor value of the last product in each response you get until your response is empty. So need to check
cursor
index available in last array of$response
then repeat call by adding cursor value withafter
attribute in products field.
Error Handling
Below errors handled with ApiException
Class
- Trying to pass invalid api version
- Trying to pass invalid shop domain
- Http REST api call exception from Guzzle(
GuzzleHttp\Exception\RequestException
)