PHPackages                             codebyzach/cbz-shopify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. codebyzach/cbz-shopify

AbandonedArchivedLibrary[API Development](/categories/api)

codebyzach/cbz-shopify
======================

PHP library for interacting with the Shopify REST &amp; GraphQL API

6.6.2(4y ago)191MITPHPPHP ^7.3

Since Jun 15Pushed 4y agoCompare

[ Source](https://github.com/CodeByZach/cbz-shopify)[ Packagist](https://packagist.org/packages/codebyzach/cbz-shopify)[ Docs](https://github.com/codebyzach/cbz-shopify)[ RSS](/packages/codebyzach-cbz-shopify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (55)Used By (0)

CbzShopify
==========

[](#cbzshopify)

[![Latest Release](https://camo.githubusercontent.com/444192170b235e890046368b9b70f9263ccae43423759b85c9e23c36d5d8d1eb/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f7461672f636f646562797a6163682f63627a2d73686f706966792e7376673f6c6162656c3d76657273696f6e)](https://github.com/codebyzach/cbz-shopify/releases) [![Shopify Admin API](https://camo.githubusercontent.com/6b8bc5e57f5d890febdb220f89a648579755260676a2c8ee133d08d95f5508c0/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f53686f7069667925323041646d696e2532304150492d323032312d2d30372d2532333741423535433f6c6f676f3d73686f7069667926636f6c6f723d23374142353543)](https://shopify.dev/api/admin)

CbzShopify is a modern PHP library based on Guzzle for the [Shopify Admin API](https://shopify.dev/api/admin).

Dependencies
------------

[](#dependencies)

- [PHP](https://www.php.net): ^7.3
- [Guzzle Services](https://github.com/guzzle/guzzle-services): ^1.2
- [Laminas Diactoros](https://github.com/laminas/laminas-diactoros): ^2.6

Installation
------------

[](#installation)

Installation of CbzShopify is officially supported using Composer:

```
composer require 'codebyzach/cbz-shopify'
```

REST API
--------

[](#rest-api)

CbzShopify provides a one-to-one mapping with API methods defined in [Shopify doc](https://shopify.dev/api/admin). Since version 4, it also supports a basic integration with the new GraphQL admin API.

### Private app

[](#private-app)

In order to use CbzShopify as a private app, you must first instantiate the client:

```
$shopify_client = new ShopifyClient([
    'private_app' => true,
    'api_key'     => 'YOUR_API_KEY',
    'password'    => 'YOUR_PASSWORD',
    'shop'        => 'domain.myshopify.com',
    'version'     => '2021-07'
]);
```

> Make sure to always include a version. [More info about Shopify versioning](https://shopify.dev/api/usage/versioning)

### Public app

[](#public-app)

When using a public app, you instantiate the client a bit differently:

```
$shopify_client = new ShopifyClient([
    'private_app'   => false,
    'api_key'       => 'YOUR_API_KEY', // In public app, this is the app ID
    'access_token'  => 'MERCHANT_TOKEN',
    'shop'          => 'merchant.myshopify.com',
    'version'       => '2021-07'
]);
```

> Make sure to always include a version. [More info about Shopify versioning](https://shopify.dev/api/usage/versioning)

### Using a container

[](#using-a-container)

CbzShopify also provides built-in [container-interop](https://github.com/container-interop/container-interop) factories that you can use. You must make sure that your container contains a service called "config" that is an array with a key `cbz_shopify` containing the required config:

```
// myconfig.php

return [
    'cbz_shopify' => [
        'private_app'   => false,
        'api_key'       => 'YOUR_API_KEY', // In public app, this is the app ID
        'access_token'  => 'MERCHANT_TOKEN',
        'shop'          => 'merchant.myshopify.com',
    ],
];
```

If you're using Zend\\ServiceManager 3, you can use [Zend\\ComponentInstaller](https://zendframework.github.io/zend-component-installer/)to register our factories into Zend\\ServiceManager automatically.

However if you're using other framework or other container, you can still manually register our factories, they are under [src/Container](/src/Container) folder.

### Validating a request

[](#validating-a-request)

CbzShopify client provides an easy way to validate an incoming request to make sure it comes from Shopify through the `RequestValidator`object. It requires a PSR7 requests and a shared secret:

```
use CbzShopify\Exception\InvalidRequestException;
use CbzShopify\Validator\RequestValidator;

$validator = new RequestValidator();

try {
    $validator->validateRequest($psr7Request, 'shared_secret');
} catch (InvalidRequestException $exception) {
    // Request is not valid
}
```

### Validating a webhook

[](#validating-a-webhook)

Similarily, you can use the `WebhookValidator` to validate your webhook:

```
use CbzShopify\Exception\InvalidWebhookException;
use CbzShopify\Validator\WebhookValidator;

$validator = new WebhookValidator();

try {
    $validator->validateWebhook($psr7Request, 'shared_secret');
} catch (InvalidWebhookException $exception) {
    // Request is not valid
}
```

### Validating an application request

[](#validating-an-application-request)

Finally, you can also use the `ApplicationProxyRequestValidator` to validate application proxy requests:

```
use CbzShopify\Exception\InvalidApplicationProxyRequestException;
use CbzShopify\Validator\ApplicationProxyRequestValidator;

$validator = new ApplicationProxyRequestValidator();

try {
  $validator->validateApplicationProxyRequest($psr7Request, 'shared_secret');
} catch {
  // Request is not valid
}
```

### Create an authorization response

[](#create-an-authorization-response)

CbzShopify provides an easy way to create a PSR7 compliant `ResponseInterface` to create an authorization response:

```
use CbzShopify\OAuth\AuthorizationRedirectResponse;

$api_key         = 'app_123';
$shop_domain     = 'shop_to_authorize.myshopify.com';
$scopes          = ['read_orders', 'read_products'];
$redirection_uri = 'https://myapp.test.com/oauth/redirect';
$nonce           = 'strong_nonce';

$response = new AuthorizationRedirectResponse($api_key, $shop_domain, $scopes, $redirection_uri, $nonce);
```

While the `nonce` parameter is required, CbzShopify does not make any assumption about how to save the nonce and check it when Shopify redirects to your server. You are responsible to safely saving the nonce.

### Exchanging a code against an access token

[](#exchanging-a-code-against-an-access-token)

You can use the `TokenExchanger` class to exchange a code to a long-lived access token:

```
use GuzzleHttp\Client;
use CbzShopify\OAuth\TokenExchanger;

$api_key       = 'app_123';
$shared_secret = 'secret_123';
$shop_domain   = 'shop_to_authorize.myshopify.com';
$code          = 'code_123';

$token_exchanger = new TokenExchanger(new Client());
$access_token    = $token_exchanger->exchangeCodeForToken($api_key, $shared_secret, $shop_domain, $code);
```

CbzShopify also provides a simple factory compliant with [container-interop](https://github.com/container-interop/container-interop)that you can register to the container of your choice, with the `CbzShopify\Container\TokenExchangerFactory`.

### Exploiting responses

[](#exploiting-responses)

CbzShopify returns Shopify response directly. However, by default, Shopify wrap the responses by a top-key. For instance, if you want to retrieve shop information, Shopify will return this payload:

```
{
    "shop": {
        "id": 123,
        "domain": "myshop.myshopify.com"
    }
}
```

This is a bit inconvenient to use as we would need to do that:

```
$shop_domain = $shopify_client->getShop()['shop']['domain'];
```

Instead, CbzShopify automatically "unwraps" response, so you can use the more concise code:

```
$shop_domain = $shopify_client->getShop()['domain'];
```

When reading Shopify API doc, make sure you remove the top key when exploiting responses.

#### Count

[](#count)

Similarily, when you use one of the `count` endpoint, CbzShopify will automatically extract the value from Shopify's response, so you do not need to manually access the count property:

```
$count = $shopify_client->countOrders();
// $count is already an integer
```

### Using iterators

[](#using-iterators)

For most "list" endpoints (`getProducts`, `getCollections`...), Shopify allows you to get up to 250 resources at a time. When using the standard `get**`method, you are responsible to handle the pagination yourself.

For convenience, CbzShopify allows you to easily iterate through all resources efficiently (internally, we are using generators). Here is how you can get all the products from a given store:

```
foreach ($shopify_client->getProductsIterator(['fields' => 'id,title']) as $product) {
   // Do something with product
}
```

CbzShopify will take care of doing additional requests when it has reached the end of a given page.

### Executing multiple requests concurrently

[](#executing-multiple-requests-concurrently)

For optimization purposes, it may be desirable to execute multiple requests concurrently. To do that, CbzShopify client allow you to take advantage of the underlying Guzzle client and execute multiple requests at the same time.

To do that, you can manually create the Guzzle commands, and execute them all. CbzShopify will take care of authenticating all requests individually, and extracting the response payload. For instance, here is how you could get both shop info and products info:

```
$command1 = $client->getCommand('GetShop', ['fields' => 'id']);
$command2 = $client->getCommand('GetProducts', ['fields' => 'id,title']);

$results = $client->executeAll([$command1, $command2]);

// $results[0] represents the response of $command1, $results[1] represents the response of $command2
```

If a request has failed, it will contain an instance of `GuzzleHttp\Command\Exception\CommandException`. For instance, here is how you could iterate through all the results:

```
use GuzzleHttp\Command\Exception\CommandException;

foreach ($results as $singleResult) {
   if ($singleResult instanceof CommandException) {
      // Get the command that has failed, and eventually retry
      $command = $singleResult->getCommand();
      continue;
   }

   // Otherwise, $singleResult is just an array that contains the Shopify data
}
```

GraphQL API
-----------

[](#graphql-api)

In 2018, Shopify launched a new API, called the [GraphQL Admin API](https://shopify.dev/api/admin/graphql/reference). This new API comes with a lot of advantages compared to the REST API:

- It allows to access more efficiently to the various Shopify resources (you can for instance get a collection, with all its products and variants, by using a single request).
- It offers access to some resources that are not exposed through the REST API.

The version 4 of CbzShopify now ships with a basic GraphQL client. It does not yet support the following features, though:

- Automatic pagination
- Automatic handling of Shopify rate limits

In order to use the client, you must instantiate it. Instead of the ShopifyClient, you must create a `CbzShopify\ShopifyGraphQLClient`. If you are using a private app:

```
$client = new ShopifyGraphQLClient([
    'shop'        => 'test.myshopify.com',
    'version'     => '2021-07',
    'private_app' => true,
    'password'    => 'YOUR PASSWORD'
]);
```

> Make sure to always include a version. [More info about Shopify versioning](https://shopify.dev/api/usage/versioning)

If you are using a public app:

```
$client = new ShopifyGraphQLClient([
    'shop'         => 'test.myshopify.com',
    'version'      => '2021-07',
    'private_app'  => false,
    'access_token' => 'ACCESS TOKEN'
]);
```

> Make sure to always include a version. [More info about Shopify versioning](https://shopify.dev/api/usage/versioning)

### Queries

[](#queries)

To perform query, simply enter your query as an heredoc. For instance, here is a GraphQL query that get the title and id of the first 5 collections, as well as the 5 first products within those collections (this used to require several queries in the REST API, while everything can be done very efficiently with GraphQL):

```
$request = request($request, $variables);

var_dump($result);
```

### Mutations

[](#mutations)

Similarly, CbzShopify supports mutation. To do this, you simply need to use a mutation query. Here is an example that is creating a product:

```
$request =  [
        'title' => 'My product'
    ]
];

$result = $client->request($request, $variables);

var_dump($result);
```

This request will create a new product whose title is "My product", and will return the id of the product.

> For better error handling, you should always include the userErrors object in your response.

### Error handling

[](#error-handling)

When using GraphQL requests, there are two kinds of errors that you can catch.

#### Request errors

[](#request-errors)

Those errors are for malformed GraphQL requests. You can catch them using the `\CbzShopify\Exception\GraphQLErrorException` exception:

```
try {
    $result = $client->request($request);
} catch (\CbzShopify\Exception\GraphQLErrorException $exception) {
    var_dump($exception->getErrors());
}
```

#### User errors

[](#user-errors)

Those errors are for requests that are missing data (like incorrect data, missing data...). You can catch them using the `\CbzShopify\Exception\GraphQLUserErrorException` exception:

```
try {
    $result = $client->request($request);
} catch (\CbzShopify\Exception\GraphQLUserErrorException $exception) {
    var_dump($exception->getErrors());
}
```

Implemented endpoints
---------------------

[](#implemented-endpoints)

- [Abandoned Checkouts](#abandoned-checkouts)
- [AccessScope](#accessscope)
- [ApplicationCharge](#applicationcharge)
- [ApplicationCredit](#applicationcredit)
- [Article](#article)
- [Asset](#asset)
- [AssignedFulfillmentOrder](#assignedfulfillmentorder)
- [Balance](#balance)
- [Balance Transaction](#balance-transaction)
- [Blog](#blog)
- [CancellationRequest](#cancellationrequest)
- [CarrierService](#carrierservice)
- [Checkout](#checkout)
- [Collect](#collect)
- [Collection](#collection)
- [CollectionListing](#collectionlisting)
- [Comment](#comment)
- [Country](#country)
- [Currency](#currency)
- [CustomCollection](#customcollection)
- [Customer](#customer)
- [Customer Address](#customer-address)
- [CustomerSavedSearch](#customersavedsearch)
- [Deprecated API Calls](#deprecated-api-calls)
- [DiscountCode](#discountcode)
- [Dispute](#dispute)
- [DraftOrder](#draftorder)
- [Event](#event)
- [Fulfillment](#fulfillment)
- [FulfillmentEvent](#fulfillmentevent)
- [FulfillmentOrder](#fulfillmentorder)
- [FulfillmentRequest](#fulfillmentrequest)
- [FulfillmentService](#fulfillmentservice)
- [GiftCard](#giftcard)
- [InventoryItem](#inventoryitem)
- [InventoryLevel](#inventorylevel)
- [Location](#location)
- [LocationsForMove](#locationsformove)
- [MarketingEvent](#marketingevent)
- [Metafield](#metafield)
- [MobilePlatformApplication](#mobileplatformapplication)
- [Order](#order)
- [Order Risk](#order-risk)
- [Page](#page)
- [Payment](#payment)
- [Payout](#payout)
- [Policy](#policy)
- [PriceRule](#pricerule)
- [Product](#product)
- [Product Image](#product-image)
- [Product ResourceFeedback](#product-resourcefeedback)
- [Product Variant](#product-variant)
- [ProductListing](#productlisting)
- [Province](#province)
- [RecurringApplicationCharge](#recurringapplicationcharge)
- [Redirect](#redirect)
- [Refund](#refund)
- [Report](#report)
- [ResourceFeedback](#resourcefeedback)
- [ScriptTag](#scripttag)
- [ShippingZone](#shippingzone)
- [Shop](#shop)
- [SmartCollection](#smartcollection)
- [StorefrontAccessToken](#storefrontaccesstoken)
- [TenderTransaction](#tendertransaction)
- [Theme](#theme)
- [Transaction](#transaction)
- [UsageCharge](#usagecharge)
- [User](#user)
- [Webhook](#webhook)
- [Other Methods](#other-methods)
- [Iterator Methods](#iterator-methods)

### [Abandoned Checkouts](https://shopify.dev/api/admin/rest/reference/orders/abandoned-checkouts)

[](#abandoned-checkouts)

```
int countAbandonedCheckouts(array $args = []);
array getAbandonedCheckouts(array $args = []);
```

### [AccessScope](https://shopify.dev/api/admin/rest/reference/access/accessscope)

[](#accessscope)

```
array getAccessScopes(array $args = []);
```

### [ApplicationCharge](https://shopify.dev/api/admin/rest/reference/billing/applicationcharge)

[](#applicationcharge)

```
array createApplicationCharge(array $args = []);
array getApplicationCharges(array $args = []);
array getApplicationCharge(array $args = []);
```

### [ApplicationCredit](https://shopify.dev/api/admin/rest/reference/billing/applicationcredit)

[](#applicationcredit)

```
array createApplicationCredit(array $args = []);
array getApplicationCredit(array $args = []);
array getApplicationCredits(array $args = []);
```

### [Article](https://shopify.dev/api/admin/rest/reference/online-store/article)

[](#article)

```
array getArticles(array $args = []);
int countArticles(array $args = []);
array getArticle(array $args = []);
array createArticle(array $args = []);
array updateArticle(array $args = []);
array getArticlesAuthors(array $args = []);
array getArticlesTags(array $args = []);
array deleteArticle(array $args = []);
```

### [Asset](https://shopify.dev/api/admin/rest/reference/online-store/asset)

[](#asset)

```
array getAssets(array $args = []);
array getAsset(array $args = []);
array createAsset(array $args = []);
array updateAsset(array $args = []);
array deleteAsset(array $args = []);
```

### [AssignedFulfillmentOrder](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/assignedfulfillmentorder)

[](#assignedfulfillmentorder)

```
array getAssignedFulfillmentOrders(array $args = []);
```

### [Balance](https://shopify.dev/api/admin/rest/reference/shopify_payments/balance)

[](#balance)

```
array getBalance(array $args = []);
```

### [Balance Transaction](https://shopify.dev/api/admin/rest/reference/shopify_payments/transaction)

[](#balance-transaction)

```
array getBalanceTransactions(array $args = []);
```

### [Blog](https://shopify.dev/api/admin/rest/reference/online-store/blog)

[](#blog)

```
array getBlogs(array $args = []);
int countBlogs(array $args = []);
array getBlog(array $args = []);
array createBlog(array $args = []);
array updateBlog(array $args = []);
array deleteBlog(array $args = []);
```

### [CancellationRequest](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/cancellationrequest)

[](#cancellationrequest)

```
array sendCancellationRequest(array $args = []);
array acceptCancellationRequest(array $args = []);
array rejectCancellationRequest(array $args = []);
```

### [CarrierService](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/carrierservice)

[](#carrierservice)

```
array createCarrierService(array $args = []);
array updateCarrierService(array $args = []);
array getCarrierServices(array $args = []);
array getCarrierService(array $args = []);
array deleteCarrierService(array $args = []);
```

### [Checkout](https://shopify.dev/api/admin/rest/reference/sales-channels/checkout)

[](#checkout)

```
array createCheckout(array $args = []);
array completeCheckout(array $args = []);
array getCheckout(array $args = []);
array updateCheckout(array $args = []);
array getCheckoutShippingRates(array $args = []);
```

### [Collect](https://shopify.dev/api/admin/rest/reference/products/collect)

[](#collect)

```
array createCollect(array $args = []);
array deleteCollect(array $args = []);
array getCollects(array $args = []);
int countCollects(array $args = []);
array getCollect(array $args = []);
```

### [Collection](https://shopify.dev/api/admin/rest/reference/products/collection)

[](#collection)

```
array getCollection(array $args = []);
array getCollectionProducts(array $args = []);
```

### [CollectionListing](https://shopify.dev/api/admin/rest/reference/sales-channels/collectionlisting)

[](#collectionlisting)

```
array getCollectionListings(array $args = []);
array getCollectionListingProductIds(array $args = []);
array getCollectionListing(array $args = []);
array createCollectionListing(array $args = []);
array getCollectionListing(array $args = []);
```

### [Comment](https://shopify.dev/api/admin/rest/reference/online-store/comment)

[](#comment)

```
array getComments(array $args = []);
int countComments(array $args = []);
array getComment(array $args = []);
array createComment(array $args = []);
array updateComment(array $args = []);
array spamComment(array $args = []);
array unspamComment(array $args = []);
array approveComment(array $args = []);
array removeComment(array $args = []);
array restoreComment(array $args = []);
```

### [Country](https://shopify.dev/api/admin/rest/reference/store-properties/country)

[](#country)

```
array getCountries(array $args = []);
int countCountries(array $args = []);
array getCountry(array $args = []);
array createCountry(array $args = []);
array updateCountry(array $args = []);
array deleteCountry(array $args = []);
```

### [Currency](https://shopify.dev/api/admin/rest/reference/store-properties/currency)

[](#currency)

```
array getCurrencies(array $args = []);
```

### [CustomCollection](https://shopify.dev/api/admin/rest/reference/products/customcollection)

[](#customcollection)

```
array getCustomCollections(array $args = []);
int countCustomCollections(array $args = []);
array getCustomCollection(array $args = []);
array createCustomCollection(array $args = []);
array updateCustomCollection(array $args = []);
array deleteCustomCollection(array $args = []);
```

### [Customer](https://shopify.dev/api/admin/rest/reference/customers/customer)

[](#customer)

```
array getCustomers(array $args = []);
array searchCustomers(array $args = []);
array getCustomer(array $args = []);
array createCustomer(array $args = []);
array updateCustomer(array $args = []);
array sendCustomerActivationUrl(array $args = []);
array sendCustomerInvite(array $args = []);
array deleteCustomer(array $args = []);
int countCustomers(array $args = []);
array getCustomerOrders(array $args = []);
```

### [Customer Address](https://shopify.dev/api/admin/rest/reference/customers/customer-address)

[](#customer-address)

```
array getCustomerAddresses(array $args = []);
array getCustomerAddress(array $args = []);
array createCustomerAddress(array $args = []);
array updateCustomerAddress(array $args = []);
array deleteCustomerAddress(array $args = []);
array updateCustomerAddresses(array $args = []);
array setDefaultCustomerAddress(array $args = []);
```

### [CustomerSavedSearch](https://shopify.dev/api/admin/rest/reference/customers/customersavedsearch)

[](#customersavedsearch)

```
array getCustomerSavedSearches(array $args = []);
int countCustomerSavedSearches(array $args = []);
array getCustomerSavedSearch(array $args = []);
array getCustomerSavedSearchCustomers(array $args = []);
array createCustomerSavedSearch(array $args = []);
array updateCustomerSavedSearch(array $args = []);
array deleteCustomerSavedSearch(array $args = []);
```

### [Deprecated API Calls](https://shopify.dev/api/admin/rest/reference/deprecated_api_calls)

[](#deprecated-api-calls)

```
array getDeprecatedApiCalls(array $args = []);
```

### [DiscountCode](https://shopify.dev/api/admin/rest/reference/discounts/discountcode)

[](#discountcode)

```
array createDiscountCode(array $args = []);
array updateDiscountCode(array $args = []);
array getDiscountCodes(array $args = []);
array getDiscountCode(array $args = []);
array lookupDiscountCode(array $args = []);
int countDiscountCodes(array $args = []);
array deleteDiscountCode(array $args = []);
array createDiscountCodeBatch(array $args = []);
array getDiscountCodeBatch(array $args = []);
array getDiscountCodeBatchDiscountCodes(array $args = []);
```

### [Dispute](https://shopify.dev/api/admin/rest/reference/shopify_payments/dispute)

[](#dispute)

```
array getDisputes(array $args = []);
array getDispute(array $args = []);
```

### [DraftOrder](https://shopify.dev/api/admin/rest/reference/orders/draftorder)

[](#draftorder)

```
array createDraftOrder(array $args = []);
array updateDraftOrder(array $args = []);
array getDraftOrders(array $args = []);
array getDraftOrder(array $args = []);
int countDraftOrders(array $args = []);
array sendDraftOrderInvoice(array $args = []);
array deleteDraftOrder(array $args = []);
array completeDraftOrder(array $args = []);
```

### [Event](https://shopify.dev/api/admin/rest/reference/events/event)

[](#event)

```
array getEvents(array $args = []);
array getEvent(array $args = []);
int countEvents(array $args = []);
```

### [Fulfillment](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/fulfillment)

[](#fulfillment)

```
array getFulfillments(array $args = []);
array getFulfillmentOrderFulfillments(array $args = []);
int countFulfillments(array $args = []);
array getFulfullment(array $args = []);
array createFulfillment(array $args = []);
array createFulfillmentOrderFulfillment(array $args = []);
array updateFulfillment(array $args = []);
array updateFulfillmentOrderFulfillment(array $args = []);
array completeFulfillment(array $args = []);
array openFulfillment(array $args = []);
array cancelFulfillment(array $args = []);
array cancelFulfillmentOrderFulfillment(array $args = []);
```

### [FulfillmentEvent](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/fulfillmentevent)

[](#fulfillmentevent)

```
array getFulfillmentEvents(array $args = []);
array getFulfillmentEvent(array $args = []);
array createFulfillmentEvent(array $args = []);
array deleteFulfillmentEvent(array $args = []);
```

### [FulfillmentOrder](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/fulfillmentorder)

[](#fulfillmentorder)

```
array getFulfillmentOrders(array $args = []);
array getFulfillmentOrder(array $args = []);
int cancelFulfillmentOrder(array $args = []);
array closeFulfillmentOrder(array $args = []);
array moveFulfillmentOrder(array $args = []);
array openFulfillmentOrder(array $args = []);
array rescheduleFulfillmentOrder(array $args = []);
```

### [FulfillmentRequest](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/fulfillmentrequest)

[](#fulfillmentrequest)

```
array sendFulfillmentRequest(array $args = []);
array acceptFulfillmentRequest(array $args = []);
array rejectFulfillmentRequest(array $args = []);
```

### [FulfillmentService](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/fulfillmentservice)

[](#fulfillmentservice)

```
array getFulfillmentServices(array $args = []);
array createFulfillmentService(array $args = []);
array getFulfillmentService(array $args = []);
array updateFulfillmentService(array $args = []);
array deleteFulfillmentService(array $args = []);
```

### [GiftCard](https://shopify.dev/api/admin/rest/reference/plus/giftcard)

[](#giftcard)

```
array getGiftCards(array $args = []);
array getGiftCard(array $args = []);
int countGiftCards(array $args = []);
array createGiftCard(array $args = []);
array updateGiftCard(array $args = []);
array disableGiftCard(array $args = []);
array searchGiftCards(array $args = [])
```

### [InventoryItem](https://shopify.dev/api/admin/rest/reference/inventory/inventoryitem)

[](#inventoryitem)

```
array getInventoryItems(array $args = []);
array getInventoryItem(array $args = []);
array updateInventoryItem(array $args = []);
```

### [InventoryLevel](https://shopify.dev/api/admin/rest/reference/inventory/inventorylevel)

[](#inventorylevel)

```
array getInventoryLevels(array $args = []);
array adjustInventoryLevel(array $args = []);
array deleteInventoryLevel(array $args = []);
array connectInventoryLevel(array $args = []);
array setInventoryLevel(array $args = []);
```

### [Location](https://shopify.dev/api/admin/rest/reference/inventory/location)

[](#location)

```
array getLocations(array $args = []);
array getLocation(array $args = []);
int countLocations(array $args = []);
array getLocationInventoryLevels(array $args = []);
```

### [LocationsForMove](https://shopify.dev/api/admin/rest/reference/shipping-and-fulfillment/locationsformove)

[](#locationsformove)

```
array getLocationsForMove(array $args = []);
```

### [MarketingEvent](https://shopify.dev/api/admin/rest/reference/marketingevent)

[](#marketingevent)

```
array getMarketingEvents(array $args = []);
int countMarketingEvents(array $args = []);
array getMarketingEvent(array $args = []);
array createMarketingEvent(array $args = []);
array updateMarketingEvent(array $args = []);
array deleteMarketingEvent(array $args = []);
array createMarketingEventEngagements(array $args = []);
```

### [Metafield](https://shopify.dev/api/admin/rest/reference/metafield)

[](#metafield)

```
array getArticleMetafields(array $args = []);
array getBlogMetafields(array $args = []);
array getCollectionMetafields(array $args = []);
array getCustomerMetafields(array $args = []);
array getDraftOrderMetafields(array $args = []);
array getOrderMetafields(array $args = []);
array getPageMetafields(array $args = []);
array getProductMetafields(array $args = []);
array getProductVariantMetafields(array $args = []);
array getProductImageMetafields(array $args = []);
array getShopMetafields(array $args = []);
int countArticleMetafields(array $args = []);
int countBlogMetafields(array $args = []);
int countCollectionMetafields(array $args = []);
int countCustomerMetafields(array $args = []);
int countDraftOrderMetafields(array $args = []);
int countOrderMetafields(array $args = []);
int countPageMetafields(array $args = []);
int countProductMetafields(array $args = []);
int countProductVariantMetafields(array $args = []);
int countProductImageMetafields(array $args = []);
int countShopMetafields(array $args = []);
array getArticleMetafield(array $args = []);
array getBlogMetafield(array $args = []);
array getCollectionMetafield(array $args = []);
array getCustomerMetafield(array $args = []);
array getDraftOrderMetafield(array $args = []);
array getOrderMetafield(array $args = []);
array getPageMetafield(array $args = []);
array getProductMetafield(array $args = []);
array getProductVariantMetafield(array $args = []);
array getProductImageMetafield(array $args = []);
array getShopMetafield(array $args = []);
array createArticleMetafield(array $args = []);
array createBlogMetafield(array $args = []);
array createCollectionMetafield(array $args = []);
array createCustomerMetafield(array $args = []);
array createDraftOrderMetafield(array $args = []);
array createOrderMetafield(array $args = []);
array createPageMetafield(array $args = []);
array createProductMetafield(array $args = []);
array createProductVariantMetafield(array $args = []);
array createProductImageMetafield(array $args = []);
array createShopMetafield(array $args = []);
array updateArticleMetafield(array $args = []);
array updateBlogMetafield(array $args = []);
array updateCollectionMetafield(array $args = []);
array updateCustomerMetafield(array $args = []);
array updateDraftOrderMetafield(array $args = []);
array updateOrderMetafield(array $args = []);
array updatePageMetafield(array $args = []);
array updateProductMetafield(array $args = []);
array updateProductVariantMetafield(array $args = []);
array updateProductImageMetafield(array $args = []);
array updateShopMetafield(array $args = []);
array deleteArticleMetafield(array $args = []);
array deleteBlogMetafield(array $args = []);
array deleteCollectionMetafield(array $args = []);
array deleteCustomerMetafield(array $args = []);
array deleteDraftOrderMetafield(array $args = []);
array deleteOrderMetafield(array $args = []);
array deletePageMetafield(array $args = []);
array deleteProductMetafield(array $args = []);
array deleteProductVariantMetafield(array $args = []);
array deleteProductImageMetafield(array $args = []);
```

### [MobilePlatformApplication](https://shopify.dev/api/admin/rest/reference/sales-channels/mobileplatformapplication)

[](#mobileplatformapplication)

```
array getMobilePlatformApplications(array $args = []);
array createMobilePlatformApplication(array $args = []);
array getMobilePlatformApplication(array $args = []);
array updateMobilePlatformApplication(array $args = []);
array deleteMobilePlatformApplication(array $args = []);
```

### [Order](https://shopify.dev/api/admin/rest/reference/orders/order)

[](#order)

```
array getOrders(array $args = []);
array getOrder(array $args = []);
int countOrders(array $args = []);
array closeOrder(array $args = []);
array openOrder(array $args = []);
array cancelOrder(array $args = []);
array createOrder(array $args = []);
array updateOrder(array $args = []);
array deleteOrder(array $args = []);
```

### [Order Risk](https://shopify.dev/api/admin/rest/reference/orders/order-risk)

[](#order-risk)

```
array createOrderRisk(array $args = []);
array getOrderRisks(array $args = []);
array getOrderRisk(array $args = []);
array updateOrderRisk(array $args = []);
array deleteOrderRisk(array $args = []);
```

### [Page](https://shopify.dev/api/admin/rest/reference/online-store/page)

[](#page)

```
array getPages(array $args = []);
int countPages(array $args = []);
array getPage(array $args = []);
array createPage(array $args = []);
array updatePage(array $args = []);
array deletePage(array $args = []);
```

### [Payment](https://shopify.dev/api/admin/rest/reference/sales-channels/payment)

[](#payment)

```
array storeCreditCard(array $args = []);
array createPayment(array $args = []);
array getPayments(array $args = []);
array getPayment(array $args = []);
int countPayments(array $args = []);
```

### [Payout](https://shopify.dev/api/admin/rest/reference/shopify_payments/payout)

[](#payout)

```
array getPayouts(array $args = []);
array getPayout(array $args = []);
```

### [Policy](https://shopify.dev/api/admin/rest/reference/store-properties/policy)

[](#policy)

```
array getPolicies(array $args = []);
```

### [PriceRule](https://shopify.dev/api/admin/rest/reference/discounts/pricerule)

[](#pricerule)

```
array createPriceRule(array $args = []);
array updatePriceRule(array $args = []);
array getPriceRules(array $args = []);
array getPriceRule(array $args = []);
int countPriceRules(array $args = []);
array deletePriceRule(array $args = []);
```

### [Product](https://shopify.dev/api/admin/rest/reference/products/product)

[](#product)

```
array getProducts(array $args = []);
int countProducts(array $args = []);
array getProduct(array $args = []);
array createProduct(array $args = []);
array updateProduct(array $args = []);
array deleteProduct(array $args = []);
```

### [Product Image](https://shopify.dev/api/admin/rest/reference/products/product-image)

[](#product-image)

```
array getProductImages(array $args = []);
int countProductImages(array $args = []);
array getProductImage(array $args = []);
array createProductImage(array $args = []);
array updateProductImage(array $args = []);
array deleteProductImage(array $args = []);
```

### [Product ResourceFeedback](https://shopify.dev/api/admin/rest/reference/sales-channels/productresourcefeedback)

[](#product-resourcefeedback)

```
array createProductResourceFeedback(array $args = []);
array getProductResourceFeedbacks(array $args = []);
```

### [Product Variant](https://shopify.dev/api/admin/rest/reference/products/product-variant)

[](#product-variant)

```
array getProductVariants(array $args = []);
int countProductVariants(array $args = []);
array getProductVariant(array $args = []);
array createProductVariant(array $args = []);
array updateProductVariant(array $args = []);
array deleteProductVariant(array $args = []);
```

### [ProductListing](https://shopify.dev/api/admin/rest/reference/sales-channels/productlisting)

[](#productlisting)

```
array getProductListings(array $args = []);
array getProductListingIds(array $args = []);
int countProductListings(array $args = []);
array getProductListing(array $args = []);
array createProductListing(array $args = []);
array deleteProductListing(array $args = []);
```

### [Province](https://shopify.dev/api/admin/rest/reference/store-properties/province)

[](#province)

```
array getProvinces(array $args = []);
int countProvinces(array $args = []);
array getProvince(array $args = []);
array updateProvince(array $args = []);
```

### [RecurringApplicationCharge](https://shopify.dev/api/admin/rest/reference/billing/recurringapplicationcharge)

[](#recurringapplicationcharge)

```
array createRecurringApplicationCharge(array $args = []);
array getRecurringApplicationCharge(array $args = []);
array getRecurringApplicationCharges(array $args = []);
array deleteRecurringApplicationCharge(array $args = []);
array updateRecurringApplicationCharge(array $args = []);
```

### [Redirect](https://shopify.dev/api/admin/rest/reference/online-store/redirect)

[](#redirect)

```
array getRedirects(array $args = []);
int countRedirects(array $args = []);
array getRedirect(array $args = []);
array createRedirect(array $args = []);
array updateRedirect(array $args = []);
array deleteRedirect(array $args = []);
```

### [Refund](https://shopify.dev/api/admin/rest/reference/orders/refund)

[](#refund)

```
array getRefunds(array $args = []);
array getRefund(array $args = []);
array calculateRefund(array $args = []);
array createRefund(array $args = []);
```

### [Report](https://shopify.dev/api/admin/rest/reference/analytics/report)

[](#report)

```
array getReports(array $args = []);
array getReport(array $args = []);
array createReport(array $args = []);
array updateReport(array $args = []);
array deleteReport(array $args = []);
```

### [ResourceFeedback](https://shopify.dev/api/admin/rest/reference/sales-channels/resourcefeedback)

[](#resourcefeedback)

```
createResourceFeedback(array $args = []);
getResourceFeedbacks(array $args = []);
```

### [ScriptTag](https://shopify.dev/api/admin/rest/reference/online-store/scripttag)

[](#scripttag)

```
array getScriptTags(array $args = []);
int countScriptTags(array $args = []);
array getScriptTag(array $args = []);
array createScriptTag(array $args = []);
array updateScriptTag(array $args = []);
array deleteScriptTag(array $args = []);
```

### [ShippingZone](https://shopify.dev/api/admin/rest/reference/store-properties/shippingzone)

[](#shippingzone)

```
array getShippingZones(array $args = []);
```

### [Shop](https://shopify.dev/api/admin/rest/reference/store-properties/shop)

[](#shop)

```
array getShop(array $args = []);
```

### [SmartCollection](https://shopify.dev/api/admin/rest/reference/products/smartcollection)

[](#smartcollection)

```
array getSmartCollections(array $args = []);
int countSmartCollections(array $args = []);
array getSmartCollection(array $args = []);
array createSmartCollection(array $args = []);
array updateSmartCollection(array $args = []);
array opdateSmartCollectionProductOrdering(array $args = []);
array deleteSmartCollection(array $args = []);
```

### [StorefrontAccessToken](https://shopify.dev/api/admin/rest/reference/access/storefrontaccesstoken)

[](#storefrontaccesstoken)

```
array createStorefrontAccessToken(array $args = []);
array deleteStorefrontAccessToken(array $args = []);
array getStorefrontAccessTokens(array $args = []);
```

### [TenderTransaction](https://shopify.dev/api/admin/rest/reference/tendertransaction)

[](#tendertransaction)

```
array getTenderTransactions(array $args = []);
```

### [Theme](https://shopify.dev/api/admin/rest/reference/online-store/theme)

[](#theme)

```
array getThemes(array $args = []);
array getTheme(array $args = []);
array createTheme(array $args = []);
array updateTheme(array $args = []);
array deleteTheme(array $args = []);
```

### [Transaction](https://shopify.dev/api/admin/rest/reference/orders/transaction)

[](#transaction)

```
array getTransactions(array $args = []);
int countTransactions(array $args = []);
array getTransaction(array $args = []);
array createTransaction(array $args = []);
```

### [UsageCharge](https://shopify.dev/api/admin/rest/reference/billing/usagecharge)

[](#usagecharge)

```
array createUsageCharge(array $args = []);
array getUsageCharge(array $args = []);
array getUsageCharges(array $args = []);
```

### [User](https://shopify.dev/api/admin/rest/reference/plus/user)

[](#user)

```
array getUsers(array $args = []);
array getUser(array $args = []);
array getCurrentUser(array $args = []);
```

### [Webhook](https://shopify.dev/api/admin/rest/reference/events/webhook)

[](#webhook)

```
array getWebhooks(array $args = []);
int countWebhooks(array $args = []);
array getWebhook(array $args = []);
array createWebhook(array $args = []);
array updateWebhook(array $args = []);
array deleteWebhook(array $args = []);
```

### Other Methods

[](#other-methods)

```
array createDelegateAccessToken(array $args = []);
```

### Iterator Methods

[](#iterator-methods)

```
Traversable getAbandonedCheckoutsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getArticlesIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getBalanceTransactionsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCollectsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCollectionProductsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCollectionListingProductIdsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCommentsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCustomCollectionsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCustomerAddressesIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable searchCustomersIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCustomersIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCustomerSavedSearchesIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getDiscountCodesIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getDisputesIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getDraftOrdersIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getEventsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getFulfillmentsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getGiftCardsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable searchGiftCardsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getInventoryItemsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getInventoryLevelsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getLocationInventoryLevelsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getMarketingEventsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getArticleMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getBlogMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCollectionMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getCustomerMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getDraftOrderMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getOrderMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getPageMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getProductMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getProductVariantMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getProductImageMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getShopMetafieldsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getOrdersIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getOrderRisksIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getPagesIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getPayoutsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getPriceRulesIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getProductsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getProductListingsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getProductVariantsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getRedirectsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getRefundsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getReportsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getScriptTagsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getSmartCollectionsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getTenderTransactionsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getTransactionsIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getUsersIterator(array $commandArgs = [], array $iteratorArgs = []);
Traversable getWebhooksIterator(array $commandArgs = [], array $iteratorArgs = []);
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 69.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~36 days

Recently: every ~84 days

Total

53

Last Release

1735d ago

Major Versions

1.5.0 → 2.0.02017-01-06

2.2.9 → 3.0.02017-06-07

3.5.0 → 4.0.02018-12-26

4.2.0 → 5.0.02019-04-15

5.5.0 → 6.0.02020-01-29

PHP version history (2 changes)1.0.0PHP ~7.0

6.6.2PHP ^7.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/44cd1c979f047d7e037722011d82c4202f766d7d6a3fe9b805c182c8859d15bb?d=identicon)[CodeByZach](/maintainers/CodeByZach)

---

Top Contributors

[![bakura10](https://avatars.githubusercontent.com/u/1198915?v=4)](https://github.com/bakura10 "bakura10 (211 commits)")[![danizord](https://avatars.githubusercontent.com/u/1850941?v=4)](https://github.com/danizord "danizord (29 commits)")[![CodeByZach](https://avatars.githubusercontent.com/u/20159826?v=4)](https://github.com/CodeByZach "CodeByZach (28 commits)")[![oojoe](https://avatars.githubusercontent.com/u/770712?v=4)](https://github.com/oojoe "oojoe (8 commits)")[![AndyJohnstonArkade](https://avatars.githubusercontent.com/u/31529835?v=4)](https://github.com/AndyJohnstonArkade "AndyJohnstonArkade (8 commits)")[![garthbrantley](https://avatars.githubusercontent.com/u/8466130?v=4)](https://github.com/garthbrantley "garthbrantley (5 commits)")[![dddbliss](https://avatars.githubusercontent.com/u/897034?v=4)](https://github.com/dddbliss "dddbliss (3 commits)")[![efficientbit](https://avatars.githubusercontent.com/u/3807256?v=4)](https://github.com/efficientbit "efficientbit (2 commits)")[![durmaj](https://avatars.githubusercontent.com/u/32449979?v=4)](https://github.com/durmaj "durmaj (2 commits)")[![John-Dormevil](https://avatars.githubusercontent.com/u/18209197?v=4)](https://github.com/John-Dormevil "John-Dormevil (2 commits)")[![Orkin](https://avatars.githubusercontent.com/u/1061903?v=4)](https://github.com/Orkin "Orkin (2 commits)")[![dangreaves](https://avatars.githubusercontent.com/u/1036142?v=4)](https://github.com/dangreaves "dangreaves (1 commits)")[![shaneferguson](https://avatars.githubusercontent.com/u/4074239?v=4)](https://github.com/shaneferguson "shaneferguson (1 commits)")[![jschaedl](https://avatars.githubusercontent.com/u/1880467?v=4)](https://github.com/jschaedl "jschaedl (1 commits)")

---

Tags

graphqlREST APIshopifyshopify-api

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/codebyzach-cbz-shopify/health.svg)

```
[![Health](https://phpackages.com/badges/codebyzach-cbz-shopify/health.svg)](https://phpackages.com/packages/codebyzach-cbz-shopify)
```

###  Alternatives

[kyon147/laravel-shopify

Shopify package for Laravel to aide in app development

473252.9k](/packages/kyon147-laravel-shopify)[rubix/server

Deploy your Rubix ML models to production with scalable stand-alone inference servers.

632.3k](/packages/rubix-server)[zfr/zfr-shopify

PHP library for interacting with the Shopify REST API

37198.8k](/packages/zfr-zfr-shopify)[slince/shopify-api-php

Shopify API Client for PHP

131236.9k1](/packages/slince-shopify-api-php)[oxid-esales/graphql-base

OXID eSales GraphQL base module

24101.0k10](/packages/oxid-esales-graphql-base)[thecodingmachine/graphqlite-laravel

A Laravel service provider package to help you get started with GraphQLite in Laravel.

1852.3k1](/packages/thecodingmachine-graphqlite-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
