PHPackages                             webtize/shopify-graphql-sdk - 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. webtize/shopify-graphql-sdk

ActiveLibrary[API Development](/categories/api)

webtize/shopify-graphql-sdk
===========================

Modern PHP SDK for Shopify GraphQL Admin API

1.0.3(10mo ago)197MITPHPPHP ^8.2

Since Aug 15Pushed 10mo agoCompare

[ Source](https://github.com/webtize/shopify-graphql-webtize-php-sdk)[ Packagist](https://packagist.org/packages/webtize/shopify-graphql-sdk)[ RSS](/packages/webtize-shopify-graphql-sdk/feed)WikiDiscussions main Synced today

READMEChangelog (6)Dependencies (9)Versions (4)Used By (0)

Shopify GraphQL PHP SDK
=======================

[](#shopify-graphql-php-sdk)

A modern, PSR-compliant PHP SDK for interacting with Shopify's GraphQL Admin API. This SDK provides a clean, object-oriented interface with automatic HTTP client discovery, rate limiting, error handling, and convenient resource helpers.

Features
--------

[](#features)

- 🚀 **Modern PHP 8.1+** with strict typing and best practices
- 🔌 **PSR-18/17 Compliant** - Works with any HTTP client (Guzzle, Symfony, etc.)
- 🛡️ **Automatic Rate Limiting** with exponential backoff and retry logic
- 🎯 **Type-Safe GraphQL** operations with query builder
- 📦 **Resource Helpers** for common operations (Products, Orders, etc.)
- ⚡ **Auto-Discovery** of HTTP clients and factories
- 🔍 **Comprehensive Error Handling** with specific exceptions
- 📖 **Extensive Documentation** and examples

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

[](#installation)

Install via Composer:

```
composer require webtize/shopify-graphql-sdk:@dev
```

For HTTP client support, also install one of the following:

```
# For Guzzle (recommended)
composer require php-http/guzzle7-adapter

# For Symfony HTTP Client
composer require symfony/http-client php-http/httplug-bundle

# For cURL adapter
composer require php-http/curl-client php-http/message
```

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

[](#quick-start)

### Basic Setup

[](#basic-setup)

```
use ShopifyGraphQL\ClientFactory;

// Simple setup with auto-discovery
$client = ClientFactory::create(
    'your-store.myshopify.com',  // or just 'your-store'
    'your-access-token-here'
);

// Get shop information
$response = $client->getShopInfo();
if ($response->isSuccessful()) {
    $shop = $response->get('shop');
    echo "Shop: " . $shop['name'];
}
```

### Using Resource Helpers

[](#using-resource-helpers)

```
use ShopifyGraphQL\Products;

$products = new Products($client);

// List products
$response = $products->list(10);
foreach ($response->get('products.edges', []) as $edge) {
    echo $edge['node']['title'] . "\n";
}

// Get single product
$product = $products->get('gid://shopify/Product/123');
echo $product->get('product.title');

// Create product
$newProduct = $products->create([
    'title' => 'New Product',
    'productType' => 'Electronics',
    'vendor' => 'ACME Corp'
]);
```

### Custom Queries with Query Builder

[](#custom-queries-with-query-builder)

```
use ShopifyGraphQL\QueryBuilder;

$query = QueryBuilder::query('GetCustomers')
    ->variable('first', 'Int!', 10)
    ->field('customers', function($builder) {
        $builder->field('edges', function($edge) {
            $edge->field('node', [
                'id', 'email', 'firstName', 'lastName'
            ]);
        });
    });

$response = $client->query($query->build(), ['first' => 5]);
```

Configuration Options
---------------------

[](#configuration-options)

```
$client = ClientFactory::create(
    'your-store.myshopify.com',
    'your-access-token',
    [
        'timeout' => 30,           // Request timeout in seconds
        'max_retries' => 3,        // Max retry attempts for rate limits
        'headers' => [             // Additional headers
            'X-Custom-Header' => 'value'
        ]
    ]
);
```

Advanced Usage
--------------

[](#advanced-usage)

### Custom HTTP Client

[](#custom-http-client)

```
use GuzzleHttp\Client as GuzzleClient;use Http\Adapter\Guzzle7\Client as GuzzleAdapter;use Nyholm\Psr7\Factory\Psr17Factory;use ShopifyGraphQL\ClientFactory;

$httpClient = new GuzzleAdapter(new GuzzleClient([
    'timeout' => 60,
    'verify' => true
]));

$factory = new Psr17Factory();

$client = ClientFactory::createWithHttpClient(
    $httpClient,
    $factory,  // Request factory
    $factory,  // Stream factory
    'your-store.myshopify.com',
    'your-access-token'
);
```

### Error Handling

[](#error-handling)

```
use ShopifyGraphQL\AuthenticationException;use ShopifyGraphQL\RateLimitException;use ShopifyGraphQL\ShopifyGraphQLException;

try {
    $response = $client->query($query);

} catch (AuthenticationException $e) {
    echo "Invalid credentials: " . $e->getMessage();

} catch (RateLimitException $e) {
    echo "Rate limited. Retry after: " . $e->getRetryAfter() . " seconds";

} catch (ShopifyGraphQLException $e) {
    echo "GraphQL Error: " . $e->getMessage();

    if ($e->hasGraphqlErrors()) {
        foreach ($e->getGraphqlErrors() as $error) {
            echo "- " . $error['message'] . "\n";
        }
    }
}
```

### Pagination

[](#pagination)

```
$products = new Products($client);
$allProducts = [];
$cursor = null;

do {
    $response = $products->list(50, $cursor);

    if (!$response->isSuccessful()) {
        break;
    }

    $data = $response->get('products');
    $edges = $data['edges'] ?? [];

    foreach ($edges as $edge) {
        $allProducts[] = $edge['node'];
        $cursor = $edge['cursor'];
    }

    $hasNextPage = $data['pageInfo']['hasNextPage'] ?? false;

} while ($hasNextPage);
```

Available Resources
-------------------

[](#available-resources)

Currently implemented resource helpers:

- `Products` - Product management operations

More resources coming soon:

- Orders
- Customers
- Collections
- Inventory
- Fulfillments

GraphQL Query Builder
---------------------

[](#graphql-query-builder)

The included query builder provides a fluent interface for constructing GraphQL queries:

```
$query = QueryBuilder::query('GetProductsAndVariants')
    ->variable('productId', 'ID!')
    ->variable('first', 'Int', 10)
    ->field('product', function($builder) {
        $builder->field('id')
                ->field('title')
                ->field('variants', function($variantBuilder) {
                    $variantBuilder->field('edges', [
                        'node' => ['id', 'title', 'price']
                    ]);
                });
    })
    ->build();
```

Rate Limiting
-------------

[](#rate-limiting)

The SDK automatically handles Shopify's rate limiting:

- Detects 429 (rate limit) responses
- Implements exponential backoff retry strategy
- Respects `Retry-After` headers
- Configurable max retry attempts

Testing
-------

[](#testing)

Run the test suite:

```
composer test
```

Run static analysis:

```
composer phpstan
```

Fix code style:

```
composer cs-fix
```

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- A PSR-18 HTTP client implementation
- Valid Shopify store and access token

Contributing
------------

[](#contributing)

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request

License
-------

[](#license)

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

Support
-------

[](#support)

- 📖 [Official Shopify GraphQL Documentation](https://shopify.dev/docs/api/admin-graphql)
- 🐛 [Issue Tracker](https://github.com/yourname/shopify-graphql-sdk/issues)
- 💬 [Discussions](https://github.com/yourname/shopify-graphql-sdk/discussions)

Changelog
---------

[](#changelog)

### v1.0.0

[](#v100)

- Initial release
- Core GraphQL client with PSR-18 support
- Query builder with fluent interface
- Products resource helper
- Automatic rate limiting and retries
- Comprehensive error handling

shopify-graphql-php-sdk
=======================

[](#shopify-graphql-php-sdk-1)

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance53

Moderate activity, may be stable

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

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 ~0 days

Total

3

Last Release

322d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/77252979?v=4)[Jigarkumar ](/maintainers/j1g4r)[@j1g4r](https://github.com/j1g4r)

---

Top Contributors

[![j1g4r](https://avatars.githubusercontent.com/u/77252979?v=4)](https://github.com/j1g4r "j1g4r (7 commits)")

---

Tags

apisdkgraphqle-commerceshopify

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/webtize-shopify-graphql-sdk/health.svg)

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

###  Alternatives

[telnyx/telnyx-php

Official Telnyx PHP SDK — APIs for Voice, SMS, MMS, WhatsApp, Fax, SIP Trunking, Wireless IoT, Call Control, and more. Build global communications on Telnyx's private carrier-grade network.

35789.4k2](/packages/telnyx-telnyx-php)[openai-php/client

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

5.8k28.0M318](/packages/openai-php-client)[flow-php/flow

PHP ETL - Extract Transform Load - Data processing framework

85036.3k](/packages/flow-php-flow)[getbrevo/brevo-php

Official Brevo provided RESTFul API V3 php library

1003.9M50](/packages/getbrevo-brevo-php)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[mollie/mollie-api-php

Mollie API client library for PHP. Mollie is a European Payment Service provider and offers international payment methods such as Mastercard, VISA, American Express and PayPal, and local payment methods such as iDEAL, Bancontact, SOFORT Banking, SEPA direct debit, Belfius Direct Net, KBC Payment Button and various gift cards such as Podiumcadeaukaart and fashioncheque.

60216.0M85](/packages/mollie-mollie-api-php)

PHPackages © 2026

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