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

ActiveLibrary[API Development](/categories/api)

arslanramay/php-shopify-api
===========================

A simple PHP API wrapper for Shopify using Guzzle

v1.0.0(1y ago)53591MITPHPPHP ^8.1

Since Jun 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/arslanramay/php-shopify-api)[ Packagist](https://packagist.org/packages/arslanramay/php-shopify-api)[ Docs](https://github.com/arslanramay/php-shopify-api)[ RSS](/packages/arslanramay-php-shopify-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

About
=====

[](#about)

A simple PHP API wrapper for Shopify using Guzzle [Shopify API](https://help.shopify.com/api/getting-started).

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

[](#installation)

Install via [Composer](https://getcomposer.org/) by running `composer require arslanramay/php-shopify-api` in your project directory.

Usage
-----

[](#usage)

In order to use this wrapper library you will need to provide credentials to access Shopify's API.

You will either need an access token for the shop you are trying to access (if using a [public application](https://help.shopify.com/api/getting-started/authentication#public-applications)) or an API Key and Secret for a [private application](https://help.shopify.com/api/getting-started/authentication#private-applications).

Code Examples
-------------

[](#code-examples)

#### Make an API call

[](#make-an-api-call)

```
use arslanramay\ShopifyPHP\Shopify;

// Initialize the client
$shopify = new Shopify('exampleshop.myshopify.com', 'mysupersecrettoken');

// Get all products
$result = $shopify->call('GET', 'admin/products.json');

// Get the products with ids of '9326553104669' and '9339160002845' with only the 'id', 'images', and 'title' fields
$result = $shopify->call('GET', 'admin/products.json', [
    'ids' => '9326553104669,9339160002845',
    'fields' => 'id,images,title',
]);

// Create a new product with title "Kerastase Shampoo 150ml"
$result = $shopify->call('POST', 'admin/products.json', [
    'product' => [
        "title"        => "Kerastase Shampoo 150ml",
        "body_html"    => "Good shampoo for hair!",
        "vendor"       => "Kerastase",
        "product_type" => "Shampoo",
        "tags"         => 'Shampoo, Kerastase, "Hair Care"',
    ],
]);
```

#### Use Private Application API Credentials to authenticate API requests

[](#use-private-application-api-credentials-to-authenticate-api-requests)

```
use arslanramay\ShopifyPHP\Shopify;

$shopify = new Shopify($data['shop'], [
    'api_key' => '...',
    'secret'  => '...',
]);
```

#### Use an access token to authenticate API requests

[](#use-an-access-token-to-authenticate-api-requests)

```
use arslanramay\ShopifyPHP\Shopify;

$storedToken = ''; // Retrieve the stored token for the shop in question
$shopify = new Shopify('exampleshop.myshopify.com', $storedToken);
```

#### Request an access\_token for a shop

[](#request-an-access_token-for-a-shop)

```
use arslanramay\ShopifyPHP\Shopify;

function make_authorization_attempt($shop, $scopes)
{
    $shopify = new Shopify($shop, [
        'api_key' => '...',
        'secret'  => '...',
    ]);

    $nonce = bin2hex(random_bytes(10));

    // Store a record of the shop attempting to authenticate and the nonce provided
    $storedAttempts = file_get_contents('authattempts.json');
    $storedAttempts = $storedAttempts ? json_decode($storedAttempts) : [];
    $storedAttempts[] = ['shop' => $shop, 'nonce' => $nonce, 'scopes' => $scopes];
    file_put_contents('authattempts.json', json_encode($storedAttempts));

    return $shopify->getAuthorizeUrl($scopes, 'https://example.com/handle/shopify/callback', $nonce);
}

header('Location: ' . make_authorization_attempt('exampleshop.myshopify.com', ['read_product']));
die();
```

#### Handle Shopify's response to the authorization request

[](#handle-shopifys-response-to-the-authorization-request)

```
use arslanramay\ShopifyPHP\Shopify;

function check_authorization_attempt()
{
    $data = $_GET;

    $shopify = new Shopify($data['shop'], [
        'api_key' => '...',
        'secret'  => '...',
    ]);

    $storedAttempt = null;
    $attempts = json_decode(file_get_contents('authattempts.json'));
    foreach ($attempts as $attempt) {
        if ($attempt->shop === $data['shop']) {
            $storedAttempt = $attempt;
            break;
        }
    }

    return $shopify->authorizeApplication($storedAttempt->nonce, $data);
}

$response = check_authorization_attempt();
if ($response) {
    // Store the access token for later use
    $response->access_token;
}
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity49

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

Unknown

Total

1

Last Release

710d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5551040b1cb5ae76a9534f8c2e067cc39b894bd0bc88f077b5d7cbbbee8f9768?d=identicon)[arslanramay](/maintainers/arslanramay)

---

Top Contributors

[![arslanramay](https://avatars.githubusercontent.com/u/2063949?v=4)](https://github.com/arslanramay "arslanramay (2 commits)")

---

Tags

php8shopifyshopify-apishopify-app-developmentphpapishopifyShopify PHP API

### Embed Badge

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

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

###  Alternatives

[openai-php/laravel

OpenAI PHP for Laravel is a supercharged PHP API client that allows you to interact with the Open AI API

3.7k7.6M74](/packages/openai-php-laravel)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)[theodo-group/llphant

LLPhant is a library to help you build Generative AI applications.

1.5k311.5k5](/packages/theodo-group-llphant)[resend/resend-php

Resend PHP library.

564.7M21](/packages/resend-resend-php)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[robwittman/shopify-php-sdk

PHP SDK for Shopify API

7098.9k1](/packages/robwittman-shopify-php-sdk)

PHPackages © 2026

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