PHPackages                             slince/shopify-api-php - 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. slince/shopify-api-php

ActiveLibrary[API Development](/categories/api)

slince/shopify-api-php
======================

Shopify API Client for PHP

3.1.0(4y ago)132244.5k↓36.6%50[18 issues](https://github.com/slince/shopify-api-php/issues)1MITPHPPHP ^7.2||^8.0CI failing

Since Nov 29Pushed 2y ago14 watchersCompare

[ Source](https://github.com/slince/shopify-api-php)[ Packagist](https://packagist.org/packages/slince/shopify-api-php)[ RSS](/packages/slince-shopify-api-php/feed)WikiDiscussions 3.x Synced 1w ago

READMEChangelogDependencies (9)Versions (31)Used By (1)

 [![](https://camo.githubusercontent.com/5a8dc7b87ac10bf7daa31a55bfd296f938a320c516bfd33eb6cb764feea71cf5/68747470733a2f2f63646e2e73686f706966792e636f6d2f73686f706966792d6d61726b6574696e675f6173736574732f6275696c64732f31392e302e302f73686f706966792d66756c6c2d636f6c6f722d626c61636b2e737667)](https://camo.githubusercontent.com/5a8dc7b87ac10bf7daa31a55bfd296f938a320c516bfd33eb6cb764feea71cf5/68747470733a2f2f63646e2e73686f706966792e636f6d2f73686f706966792d6d61726b6574696e675f6173736574732f6275696c64732f31392e302e302f73686f706966792d66756c6c2d636f6c6f722d626c61636b2e737667)

🚀 PHP SDK for the Shopify API

 [ ![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265) ](LICENSE) [ ![Build Status](https://camo.githubusercontent.com/63100de1abdd7b4a840e17192b7214384137ee620f2b53da42d050b32fde71c2/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f736c696e63652f73686f706966792d6170692d7068702f746573742e796d6c3f7374796c653d666c61742d737175617265) ](https://github.com/slince/shopify-api-php/actions) [ ![Coverage Status](https://camo.githubusercontent.com/07ed5fe695ebe93e5660c21ee5563b33918f0dd5f7dc3d19e98bcc4e22dd38ed/68747470733a2f2f696d672e736869656c64732e696f2f636f6465636f762f632f6769746875622f736c696e63652f73686f706966792d6170692d7068702f332e783f7374796c653d666c61742d737175617265) ](https://codecov.io/github/slince/shopify-api-php) [ ![Latest Stable Version](https://camo.githubusercontent.com/eb74ca172bcdc5e7540bf02dcbef5b974328c4ea57c85b0b6aca275218d24d3b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736c696e63652f73686f706966792d6170692d7068702e7376673f7374796c653d666c61742d737175617265266c6162656c3d737461626c65) ](https://packagist.org/packages/slince/shopify-api-php) [ ![Scrutinizer](https://camo.githubusercontent.com/d35ef2293d6c508330dd366a8762f299b59f72726566c02cc114ecc29adbc865/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f736c696e63652f73686f706966792d6170692d7068702e7376673f7374796c653d666c61742d737175617265) ](https://scrutinizer-ci.com/g/slince/shopify-api-php/?branch=master) [ ![Total Downloads](https://camo.githubusercontent.com/307492e51b33fba5140ef7e17460ae53832dad80a673ecf704ba56c1b9b0cdc1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f736c696e63652f73686f706966792d6170692d7068702e7376673f7374796c653d666c61742d737175617265) ](https://packagist.org/packages/slince/shopify-api-php)

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

[](#installation)

Install via composer

```
$ composer require slince/shopify-api-php
```

Quick Start
-----------

[](#quick-start)

### Initialize the client

[](#initialize-the-client)

You first need to initialize the client. For that you need your Shop Name and AccessToken

```
require __DIR__ . '/vendor/autoload.php';

$credential = new Slince\Shopify\PublicAppCredential('Access Token');
// Or Private App
$credential = new Slince\Shopify\PrivateAppCredential('API KEY', 'PASSWORD', 'SHARED SECRET');

$client = new Slince\Shopify\Client('your-store.myshopify.com', $credential, [
    'meta_cache_dir' => './tmp' // Metadata cache dir, required
]);
```

### Middleware

[](#middleware)

Middleware augments the functionality of handlers by invoking them in the process of generating responses. Middleware is implemented as a higher order function that takes the following form.

```
$middleware = function(\Psr\Http\Message\ServerRequestInterface $request, callable $next){
    $response = $next($request);
    $this->logger->log($request, $response);
    return $response;
};

$client->getMiddlewares()->push($middleware);
```

Built-in middleware:

- [DelayMiddleware](src/Middleware/DelayMiddleware.php)

### Exception

[](#exception)

The Client throws the following types of exceptions.

- [BadRequestException](src/Exception/BadRequestException.php) 400
- [UnauthorizedException](src/Exception/UnauthorizedException.php) 401
- [PaymentRequiredException](src/Exception/PaymentRequiredException.php) 402
- [ForbiddenException](src/Exception/ForbiddenException.php) 403
- [NotFoundException](src/Exception/NotFoundException.php) 404
- [NotAcceptableException](src/Exception/NotAcceptableException.php) 406
- [UnprocessableEntityException](src/Exception/UnprocessableEntityException.php) 422
- [TooManyRequestsException](src/Exception/TooManyRequestsException.php) 429
- [ClientException](src/Exception/ClientException.php) other

### Use Manager to manipulate your data;

[](#use-manager-to-manipulate-your-data)

- Lists products

```
$products = $client->getProductManager()->findAll([
    // Filter your product
    'collection_id' => 841564295
    'page' => 2 // deprecated
]);
```

- Lists products by pagination

```
$pagination = $client->getProductManager()->paginate([
    // filter your product
    'limit' => 3,
    'created_at_min' => '2015-04-25T16:15:47-04:00'
]);
// $pagination is instance of `Slince\Shopify\Common\CursorBasedPagination`

$currentProducts = $pagination->current(); //current page

while ($pagination->hasNext()) {
    $nextProducts = $pagination->next();
}

# to persist across requests you can use next_page_info and previous_page_info
$nextPageInfo = $pagination->getNextPageInfo();
$prevPageInfo = $pagination->getPrevPageInfo();

$products = $pagination->current($nextPageInfo);
```

- Get the specified product

```
$product = $client->getProductManager()->find(12800);

// Update the given product
$product = $client->getProductManager()->update(12800, [
      "title" => "Burton Custom Freestyle 151",
      "body_html" => "Good snowboard!",
      "vendor"=> "Burton",
      "product_type" => "Snowboard",
]);
```

- Creates a new product

```
$product = $client->getProductManager()->create([
      "title" => "Burton Custom Freestyle 151",
      "body_html" => "Good snowboard!",
      "vendor"=> "Burton",
      "product_type" => "Snowboard",
]);
```

- Removes the product by its id

```
$client->getProductManager()->remove(12800);
```

The product is an instance of `Slince\Shopify\Manager\Product\Product`; You can access properties like following:

```
echo $product->getTitle();
echo $product->getCreatedAt(); // DateTime Object
//...
print_r($product->getVariants());
print_r($product->getImages());
```

Available managers:

- [Access\\AccessScope](src/Service/Access/AccessScopeManagerInterface.php)
- [Access\\StorefrontAccessToken](src/Service/Access/StorefrontAccessTokenManagerInterface.php)
- [Analytics\\Report](src/Service/Analytics/ReportManagerInterface.php)
- [Billing\\ApplicationCharge](src/Service/Billing/ApplicationChargeManagerInterface.php)
- [Billing\\ApplicationCredit](src/Service/Billing/ApplicationCreditManagerInterface.php)
- [Billing\\RecurringApplicationCharge](src/Service/Billing/RecurringApplicationChargeManagerInterface.php)
- [Billing\\UsageCharge](src/Service/Billing/UsageChargeManagerInterface.php)
- [Customers\\Address](src/Service/Customers/AddressManagerInterface.php)
- [Customers\\Customer](src/Service/Customers/CustomerManagerInterface.php)
- [Customers\\CustomerSavedSearch](src/Service/Customers/CustomerSavedSearchManagerInterface.php)
- [Discounts\\DiscountCode](src/Service/Discounts/DiscountCodeManagerInterface.php)
- [Discounts\\PriceRule](src/Service/Discounts/PriceRuleManagerInterface.php)
- [Events\\Event](src/Service/Events/EventManagerInterface.php)
- [Events\\Webhook](src/Service/Events/WebhookManagerInterface.php)
- [Inventory\\InventoryItem](src/Service/Inventory/InventoryItemManagerInterface.php)
- [Inventory\\InventoryLevel](src/Service/Inventory/InventoryLevelManagerInterface.php)
- [Inventory\\Location](src/Service/Inventory/LocationManagerInterface.php)
- [MarketingEvent\\MarketingEvent](src/Service/MarketingEvent/MarketingEventManagerInterface.php)
- [OnlineStore\\Article](src/Service/OnlineStore/ArticleManagerInterface.php)
- [OnlineStore\\Asset](src/Service/OnlineStore/AssetManagerInterface.php)
- [OnlineStore\\Blog](src/Service/OnlineStore/BlogManagerInterface.php)
- [OnlineStore\\Comment](src/Service/OnlineStore/CommentManagerInterface.php)
- [OnlineStore\\Page](src/Service/OnlineStore/PageManagerInterface.php)
- [OnlineStore\\Redirect](src/Service/OnlineStore/RedirectManagerInterface.php)
- [OnlineStore\\ScriptTag](src/Service/OnlineStore/ScriptTagManagerInterface.php)
- [OnlineStore\\Theme](src/Service/OnlineStore/ThemeManagerInterface.php)
- [Orders\\DraftOrder](src/Service/Orders/DraftOrderManagerInterface.php)
- [Orders\\Order](src/Service/Orders/OrderManagerInterface.php)
- [Orders\\Refund](src/Service/Orders/RefundManagerInterface.php)
- [Orders\\Risk](src/Service/Orders/RiskManagerInterface.php)
- [Orders\\Transaction](src/Service/Orders/TransactionManagerInterface.php)
- [Products\\Collect](src/Service/Products/CollectManagerInterface.php)
- [Products\\CustomCollection](src/Service/Products/CustomCollectionManagerInterface.php)
- [Products\\Image](src/Service/Products/ImageManagerInterface.php)
- [Products\\Product](src/Service/Products/ProductManagerInterface.php)
- [Products\\SmartCollection](src/Service/Products/SmartCollectionManagerInterface.php)
- [Products\\Variant](src/Service/Products/VariantManagerInterface.php)
- [Shipping\\AssignedFulfillmentOrder](src/Service/Shipping/AssignedFulfillmentOrderManagerInterface.php)
- [Shipping\\CarrierService](src/Service/Shipping/CarrierServiceManagerInterface.php)
- [Shipping\\Fulfillment](src/Service/Shipping/FulfillmentManagerInterface.php)
- [Shipping\\FulfillmentOrder](src/Service/Shipping/FulfillmentOrderManagerInterface.php)
- [Shipping\\FulfillmentService](src/Service/Shipping/FulfillmentServiceManagerInterface.php)
- [Store\\Country](src/Service/Store/CountryManagerInterface.php)
- [Store\\Currency](src/Service/Store/CurrencyManagerInterface.php)
- [Store\\Policy](src/Service/Store/PolicyManagerInterface.php)
- [Store\\Province](src/Service/Store/ProvinceManagerInterface.php)
- [Store\\ShippingZone](src/Service/Store/ShippingZoneManagerInterface.php)
- [Store\\Shop](src/Service/Store/ShopManagerInterface.php)

You can access the manager like `$client->getProductManager()`, `$client->getOrderManager()`.

### Basic CURD

[](#basic-curd)

If you don't like to use managers, you can also manipulate data like this:

The returned value is just an array;

```
$products = $client->get('products', [
    // Filter your products
]);

$product = $client->get('products/12800');

$product = $client->post('products', [
    "product" => [
        "title" => "Burton Custom Freestyle 151",
        "body_html" => "Good snowboard!",
        "vendor"=> "Burton",
        "product_type" => "Snowboard",
        "images" => [
            [
                "attachment" => "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAw==\n"
            ]
        ]
     ]
]);

$product = $client->put('products/12800', [
    "product" => [
        "title" => "Burton Custom Freestyle 151",
        "body_html" => "Good snowboard!",
        "vendor"=> "Burton",
        "product_type" => "Snowboard",
        "images" => [
            [
                "attachment" => "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAw==\n"
            ]
        ]
     ]
]);

$client->delete('products/12800');
```

LICENSE
-------

[](#license)

The MIT license. See [MIT](https://opensource.org/licenses/MIT)

###  Health Score

48

—

FairBetter than 94% of packages

Maintenance17

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community28

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~79 days

Recently: every ~237 days

Total

28

Last Release

961d ago

Major Versions

1.0.0-beta2 → 2.0.0-beta12018-01-31

2.6.0 → 3.0.0-beta12020-12-17

PHP version history (4 changes)1.0.0-beta1PHP &gt;=5.6.0

2.5.0PHP ^7.2

2.6.0PHP ^7.2||^8.0

3.x-devPHP &gt;=8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3785826?v=4)[Tao](/maintainers/slince)[@slince](https://github.com/slince)

---

Top Contributors

[![slince](https://avatars.githubusercontent.com/u/3785826?v=4)](https://github.com/slince "slince (192 commits)")[![maximzasorin](https://avatars.githubusercontent.com/u/13367689?v=4)](https://github.com/maximzasorin "maximzasorin (28 commits)")[![coreyee](https://avatars.githubusercontent.com/u/16696867?v=4)](https://github.com/coreyee "coreyee (5 commits)")[![baorv](https://avatars.githubusercontent.com/u/9483946?v=4)](https://github.com/baorv "baorv (3 commits)")[![imandydoan](https://avatars.githubusercontent.com/u/62533868?v=4)](https://github.com/imandydoan "imandydoan (3 commits)")[![jonathangreco](https://avatars.githubusercontent.com/u/1587180?v=4)](https://github.com/jonathangreco "jonathangreco (3 commits)")[![mazepina](https://avatars.githubusercontent.com/u/191712611?v=4)](https://github.com/mazepina "mazepina (2 commits)")[![schevgeny](https://avatars.githubusercontent.com/u/364299?v=4)](https://github.com/schevgeny "schevgeny (1 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (1 commits)")[![benholmen](https://avatars.githubusercontent.com/u/1056188?v=4)](https://github.com/benholmen "benholmen (1 commits)")[![steefaan](https://avatars.githubusercontent.com/u/5982785?v=4)](https://github.com/steefaan "steefaan (1 commits)")

---

Tags

apisdkshopifyshopify-apishopify-clientshopify-phpshopify-sdkrestfulshopifyshopify-apishopify-sdkshopify-clientshopify-client-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/slince-shopify-api-php/health.svg)

```
[![Health](https://phpackages.com/badges/slince-shopify-api-php/health.svg)](https://phpackages.com/packages/slince-shopify-api-php)
```

###  Alternatives

[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k11](/packages/tempest-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M710](/packages/sylius-sylius)[statamic/cms

The Statamic CMS Core Package

4.8k3.5M901](/packages/statamic-cms)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M195](/packages/sulu-sulu)[craftcms/cms

Craft CMS

3.6k3.6M2.9k](/packages/craftcms-cms)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M506](/packages/shopware-core)

PHPackages © 2026

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