PHPackages                             long-blade/shopify-plugin - 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. long-blade/shopify-plugin

AbandonedArchivedLibrary[API Development](/categories/api)

long-blade/shopify-plugin
=========================

Shopify plugin for CakePHP

v1.2.4(4y ago)03MITPHP

Since Apr 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/long-blade/shopify-plugin)[ Packagist](https://packagist.org/packages/long-blade/shopify-plugin)[ Docs](https://gitlab.sld.gr/mmavroforakis/shopify-plugin)[ RSS](/packages/long-blade-shopify-plugin/feed)WikiDiscussions main Synced 1w ago

READMEChangelogDependencies (2)Versions (9)Used By (0)

Shopify plugin for CakePHP
==========================

[](#shopify-plugin-for-cakephp)

A shopify plugin that interacts with [shopify api](https://shopify.dev/docs/admin-api/rest/reference)

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

[](#installation)

You can install this plugin into your CakePHP application using [composer](https://getcomposer.org).

The recommended way to install composer packages is:

```
$ composer require long-blade/shopify-plugin
```

Last, you need to [load](https://book.cakephp.org/4/en/plugins.html#loading-a-plugin) the plugin to your project!

```
// src/Application.php in bootstrap() method

$this->addPlugin('Shopify');
```

---

Site object
-----------

[](#site-object)

In order to interact with the plugin you need to create a site object with the minimum require data.

```
use Shopify\Model\Site;

$siteId = 0; // a unique id (it can be the id of the entry in a database table)
$site = new Site('hostname', 'apiKey', 'apiPassword', $siteId);
```

This object is injected to the constructor on each resource class.

```
use Shopify\Model\Site;
$site = new Site('hostname', 'apiKey', 'apiPassword', 0);

// Then use this object for any resource, for example:
use Shopify\Resource\Products;
$products = new Products($site);
```

\##Resources

\###Shop The resource lets you retrieve information about the store but doesn't let you update any information.

```
use Shopify\Model\Site;
$site = new Site('hostname', 'apiKey', 'apiPassword', 0);

use Shopify\Resource\Shop;
$shop = new Shop($site);

// Then we perform a simple get request by chaining the getResource method
$shopInfo = $shop->getResource();
```

Response will be an array. [Shop properties](https://shopify.dev/docs/admin-api/rest/reference/store-properties/shop#properties-2021-01)

---

\###Product The [Product](https://shopify.dev/docs/admin-api/rest/reference/products/product#properties-2021-01) resource lets you update and create products in a merchant's store.

```
use Shopify\Resource\Products;
$productsResource = new Products($site);
```

How to fetch info about products:

```
//Retrieves a list of products
$products = $productsResource->getResource();

//Retrieves a single product
$product = $productsResource->getById(0102040506);

//Retrieves a list of product variants
$product = $productsResource->getVariantsForProduct(0102040506);
```

How to create a new Product:

```
$productData = [
    'title' => 'This is a product title',
    'description' => 'This is a product description'
];

$product = new \Shopify\Model\Product($productData);

//Creates a new product by passing the product object created.
$productsResource->post($product);
```

You can also export to json file the response of a product query like so:

```
// $productsResource = new Products($site);
$productsResource->export(['products' => [...]]);
```

This will export the response object to a json file in a location specified in the `Shopify/config/bootstrap.php` file:

```
[
'export' => [
        'path' => RESOURCES . 'json' . DS,
        'file_type' => 'json',
        'lifetime' => 60 * 60 * 3, // The lifetime which a file is consider to be old
    ],
];
```

---

\###Inventory An [inventory level](https://shopify.dev/docs/admin-api/rest/reference/inventory/inventorylevel#properties-2021-01) represents the available quantity of an inventory item at a specific location.

How to Set availability for a product:

```
$inventory = [
    'location_id' => 987654321, // The ID of the location that the inventory level belongs to.
    'inventory_item_id' => 123456789, // The ID of the inventory item that the inventory level belongs to.
    'available' => 10 // The quantity of inventory items available for sale.
];
$inventory = new \Shopify\Model\Inventory($inventory); // Create the entity;
$inventoryResource = new \Shopify\Resource\InventoryLevels($site);
$inventoryResource->setInventory($inventory);
```

How to Adjust the available quantity of an inventory item by 5 at a single location:

```
$inventory = [
    'location_id' => 987654321, // The ID of the location that the inventory level belongs to.
    'inventory_item_id' => 123456789, // The ID of the inventory item that the inventory level belongs to.
    'available_adjustment' => 5 // The amount to adjust the available inventory quantity. Send negative values to subtract from the current available quantity.
];
$inventory = new \Shopify\Model\Inventory($inventory); // Create the entity;
$inventoryResource = new \Shopify\Resource\InventoryLevels($site);
$inventoryResource->adjustInventory($inventory);
```

---

\###Order An [order](https://shopify.dev/docs/admin-api/rest/reference/orders/order#properties-2021-01) is a customer's completed request to purchase one or more products from a shop.

How to Retrieve a list of orders:

```
$orders = new Shopify\Resource\Orders($site);
// All orders
$allOrdersWithoutPagination = $orders->getPaginatedResource();

// All orders since Id:
$ordersSinsId= $orders->getOrdersSinceId(3692914802743);
```

---

\###Smart Collections

The [Collect](https://shopify.dev/docs/admin-api/rest/reference/products/smartcollection#properties-2021-01) resource is used to connect a product to a smart collection. However, these collects can't be added or removed from the API as they're managed by the rules of the smart collection.

How to get the collection a product belongs to:

```
use Shopify\Resource\SmartCollections;
$smrtCollections = new SmartCollections($site);

// This will return an array containing all the collections a product belongs to.
$collection = $smrtCollections->get(['product_id' => '12345678'])->getResource('smart_collections');
```

License
-------

[](#license)

[MIT](https://choosealicense.com/licenses/mit/)

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~8 days

Recently: every ~14 days

Total

8

Last Release

1803d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/80c1a4767d4af2c5df2e8fa525b90d5d124906ddeab841b75c46a6b9c605f393?d=identicon)[long-blade](/maintainers/long-blade)

---

Top Contributors

[![long-blade](https://avatars.githubusercontent.com/u/11339340?v=4)](https://github.com/long-blade "long-blade (1 commits)")

---

Tags

plugincakephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/long-blade-shopify-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/long-blade-shopify-plugin/health.svg)](https://phpackages.com/packages/long-blade-shopify-plugin)
```

###  Alternatives

[dereuromark/cakephp-tools

A CakePHP plugin containing lots of useful and reusable tools

338920.1k32](/packages/dereuromark-cakephp-tools)[dereuromark/cakephp-tinyauth

A CakePHP plugin to handle user authentication and authorization the easy way.

129228.6k10](/packages/dereuromark-cakephp-tinyauth)[friendsofcake/crud-json-api

Listener for building CakePHP Crud APIs following the JSON API specification.

58445.4k3](/packages/friendsofcake-crud-json-api)[dereuromark/cakephp-databaselog

A CakePHP plugin for storing and viewing application logs in the database

44165.0k2](/packages/dereuromark-cakephp-databaselog)[dereuromark/cakephp-setup

A CakePHP plugin containing lots of useful management tools

36162.8k2](/packages/dereuromark-cakephp-setup)[bcrowe/cakephp-api-pagination

CakePHP 4 plugin that injects pagination information into API responses.

3953.5k1](/packages/bcrowe-cakephp-api-pagination)

PHPackages © 2026

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