PHPackages                             yorki/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. yorki/shopify

ActiveLibrary[API Development](/categories/api)

yorki/shopify
=============

Shopify API Client

01PHP

Since Mar 25Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Yorkii/shopify)[ Packagist](https://packagist.org/packages/yorki/shopify)[ RSS](/packages/yorki-shopify/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Shopify REST API Client for PHP
===============================

[](#shopify-rest-api-client-for-php)

```
$client = new Client([
    'shop_url' => 'myshop.myshopify.com',
    'api_key' => 'shopify-api-key',
    'api_password' => 'shopify-api-password',
]);

```

```
// Get customer by ID
$customer = $client->customer()
    ->get(152990151821);

// One way of accessing customer data is by properties
if ($customer->accepts_marketing) {
    //do your stuff
}

// You can also use getters
$customer->getOrdersCount();

// Dates are casted to Carbon objects
$customer->getCreatedAt()->format('d.m.Y');

// You can chain to call api for customer orders
// This method does return Collection which you can iterate
foreach ($customer->orders() as $order) {
    $order->getTotalPrice();
}

// You can trigger specific actions for resource
// This method does call api for activation url for customer
$link = $customer->accountActivationUrl();

// Get Product
$product = $client->product()->get(217318923993);

// Some resources have dependencies, like product variants belongs to product
foreach ($product->getVariants() as $variant) {
    $variant->getPrice();
}

// You can also get all variants this way
$variants = $client->productVariant()->of($product)->all();

// Or even this way
$variants = $client->productVariant()->using(['product_id' => 217318923993])->all();

// You add listing criteria on resources
$criteria = $client->product()->criteria();
$criteria->whereTitle('T-Shirt')
    ->whereCreatedAtMin(Carbon::today()->modify('-1 week'));

// You can use between method for fields which has _min and _max suffix
$criteria->whereBetween('created_at', [Carbon::yesterday(), Carbon::today()]);

// Or
$criteria->whereCreatedAtBetween(Carbon::yesterday(), Carbon::today());

// You can use where method instead of dynamic camel case
$criteria->where('vendor', 'myvendor');

// Results are paginated, you can set limit and page
$criteria->limit(10)
    ->page(1);

// Get all products with given criteria
$products = $client->product()->all($criteria);

```

```
// Serve webhooks
$events = $client->events();

// Check if request is signed correctly
if ($events->isValidRequest()) {
    // You can get current topic
    $topic = $events->getTopic();

    // You can get shop domain this event is for
    $events->getShopDomain();

    // You can capture specific event manually
    if ($topic === $events->cartCreate()->topic()) {
        $cartCreateEvent = $events->cartCreate()->capture();
    }

    // Or do it automatically based on topic
    $cartCreateEvent = $events->capture();

    // Iterate over collection
    foreach ($cartCreateEvent->getLineItems() as $lineItem) {
        // Get price for cart item
        $lineItem->getPrice();
    }
}

```

```
// Get product of ID 1699015181608
$product = $client->product()
    ->get(1699015181608);

// Modify this product via setters and save it
$product->setTitle('Star Wars T-Shirt')
    ->setBodyHtml('Fancy Star Warsstrong> T-Shirt')
    ->setTags(['star wars', 'tshirt'])
    ->save();

// Lets iterate over product variants
foreach ($product->variants as $variant) {
    // Change price for given sku
    if ($variant->sku === 'tshirt-star-wars') {
        // Set new price via property and save
        $variant->price = 19.99;
        $variant->save();
    }
}

// We can set new body_html via property aswell
$product->body_html = 'Fancy Star Wars T-Shirt which costs $19.99';
$product->save();

```

```
// Get our shop details
$shop = $client->shop()->get();
echo 'Shop ' . $shop->name . ', ';
echo 'located at ' . $shop->address1 . ', ' . $shop->zip . ' ' . $shop->city;

if ($shop->taxes_included) {
    echo '- taxes are included';
}

echo ', current plan is ' . $shop->plan_display_name;

// All dates are transformed to Carbon object
echo ', created at ' . $shop->created_at->fomat('H:i:s, d.m.Y');

```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity1

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity37

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e4d3e2ac1bee448bce2849cdc615ace846f8a2431d2dd5a0b483bd4077234c9e?d=identicon)[yorki](/maintainers/yorki)

---

Top Contributors

[![npabisz](https://avatars.githubusercontent.com/u/13676368?v=4)](https://github.com/npabisz "npabisz (5 commits)")

### Embed Badge

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

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

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M475](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M270](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M453](/packages/google-gax)

PHPackages © 2026

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