PHPackages                             luminarix/laravel-shopify-graphql - 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. luminarix/laravel-shopify-graphql

ActiveLibrary

luminarix/laravel-shopify-graphql
=================================

GraphQL client for Shopify.

v4.0.2(5mo ago)75.8k↑55%1[3 PRs](https://github.com/luminarix/laravel-shopify-graphql/pulls)MITPHPPHP ^8.3CI passing

Since May 15Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/luminarix/laravel-shopify-graphql)[ Packagist](https://packagist.org/packages/luminarix/laravel-shopify-graphql)[ Docs](https://github.com/luminarix/laravel-shopify-graphql)[ GitHub Sponsors](https://github.com/luminarix)[ RSS](/packages/luminarix-laravel-shopify-graphql/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (15)Versions (29)Used By (0)

GraphQL client for Shopify
==========================

[](#graphql-client-for-shopify)

[![Latest Version on Packagist](https://camo.githubusercontent.com/c43c1b774b32a4481fcf7edfffbba6c12da6cf4b9bf88de216bc47f09aec32c5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6c756d696e617269782f6c61726176656c2d73686f706966792d6772617068716c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/luminarix/laravel-shopify-graphql)[![GitHub Tests Action Status](https://camo.githubusercontent.com/c8ccb8fa98f5073c6c8ce31a45781ea21ad425220b60e89987b3b60c5e773984/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c756d696e617269782f6c61726176656c2d73686f706966792d6772617068716c2f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/luminarix/laravel-shopify-graphql/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/130165d965169a1856dcff9b5a076114d4f6c81758995ebc28a5b43f13dc6f85/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6c756d696e617269782f6c61726176656c2d73686f706966792d6772617068716c2f6669782d7068702d636f64652d7374796c652d6973737565732e796d6c3f6272616e63683d6d61696e266c6162656c3d636f64652532307374796c65267374796c653d666c61742d737175617265)](https://github.com/luminarix/laravel-shopify-graphql/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/b9397cc5cf4136ebc0dd02b1f7de71113479adafd1623db03d154934562ee253/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c756d696e617269782f6c61726176656c2d73686f706966792d6772617068716c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/luminarix/laravel-shopify-graphql)

A Laravel package for interacting with Shopify's GraphQL Admin API. Built on [Saloon](https://github.com/saloonphp/saloon) with automatic rate limiting and retry handling.

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

[](#installation)

```
composer require luminarix/laravel-shopify-graphql
```

Publish the config file:

```
php artisan vendor:publish --tag="shopify-graphql-config"
```

Basic Usage
-----------

[](#basic-usage)

```
use Luminarix\Shopify\GraphQLClient\Facades\GraphQLClient;
use Luminarix\Shopify\GraphQLClient\Authenticators\ShopifyApp;

$authenticator = new ShopifyApp($shopDomain, $accessToken);
$client = GraphQLClient::factory()->create($authenticator);

// Query
$response = $client->query('
    query {
        shop {
            name
            email
        }
    }
');

$data = $response->toArray();

// Mutation
$response = $client->mutate('
    mutation orderMarkAsPaid($input: OrderMarkAsPaidInput!) {
        orderMarkAsPaid(input: $input) {
            order {
                id
            }
            userErrors {
                field
                message
            }
        }
    }
', [
    'input' => [
        'id' => 'gid://shopify/Order/123456789',
    ],
]);
```

Eloquent Model Integration
--------------------------

[](#eloquent-model-integration)

Create a service class to manage client instances:

```
namespace App\Services;

use App\Models\ShopifyShop;
use Luminarix\Shopify\GraphQLClient\Facades\GraphQLClient;
use Luminarix\Shopify\GraphQLClient\Authenticators\ShopifyApp;
use Luminarix\Shopify\GraphQLClient\GraphQLClientMethods;

class ShopifyGraphQLService
{
    public function with(ShopifyShop $shop): GraphQLClientMethods
    {
        $authenticator = new ShopifyApp($shop->domain, $shop->access_token);

        return GraphQLClient::factory()->create($authenticator);
    }
}
```

Create a trait for your models:

```
namespace App\Traits;

use App\Services\ShopifyGraphQLService;
use Luminarix\Shopify\GraphQLClient\GraphQLClientMethods;

trait InteractsWithShopifyGraphQL
{
    public function graphql(): GraphQLClientMethods
    {
        return app(ShopifyGraphQLService::class)->with($this);
    }
}
```

Use on your Shopify shop model:

```
namespace App\Models;

use App\Traits\InteractsWithShopifyGraphQL;
use Illuminate\Database\Eloquent\Model;

class ShopifyShop extends Model
{
    use InteractsWithShopifyGraphQL;
}
```

Now you can call GraphQL directly from your model:

```
$shop = ShopifyShop::find(1);

$result = $shop->graphql()->query('
    query {
        shop {
            name
        }
    }
')->toArray();
```

Response Handling
-----------------

[](#response-handling)

All query and mutation methods return a `GraphQLClientTransformer`:

```
$response = $client->query($query);

$response->toArray();       // array
$response->toCollection();  // Illuminate\Support\Collection
$response->toFluent();      // Illuminate\Support\Fluent
$response->toJson();        // string
$response->toDTO(MyDTO::class);  // Custom DTO instance
```

The transformer is also equipped with the `Macroable` trait so you can add your own custom methods if needed.

### Getting Response with Extensions

[](#getting-response-with-extensions)

Pass `withExtensions: true` to include cost and rate limit data:

```
$response = $client->query($query, withExtensions: true);
// Returns: ['data' => [...], 'extensions' => ['cost' => [...]]]
```

Bulk Operations
---------------

[](#bulk-operations)

For large data exports, use bulk operations:

```
// Start a bulk operation
$result = $client->createBulkOperation('
    {
        products {
            edges {
                node {
                    id
                    title
                }
            }
        }
    }
');

// Check current bulk operation status
$status = $client->getCurrentBulkOperation();

// Get a specific bulk operation by ID
$operation = $client->getBulkOperation($numericId);

// Cancel running bulk operation
$client->cancelBulkOperation();
```

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

[](#rate-limiting)

The package automatically handles Shopify's rate limits:

- Tracks query costs from response extensions
- Waits when throttled before retrying
- Configurable retry attempts

Get current rate limit info:

```
$info = $client->getRateLimitInfo();
// [
//     'requestedQueryCost' => 10,
//     'actualQueryCost' => 8,
//     'maxAvailableLimit' => 1000,
//     'lastAvailableLimit' => 992,
//     'restoreRate' => 50,
//     'isThrottled' => false,
// ]
```

### Custom Rate Limit Service

[](#custom-rate-limit-service)

Implement `RateLimitable` to customize rate limit handling:

```
use Luminarix\Shopify\GraphQLClient\Contracts\RateLimitable;

class CustomRateLimitService implements RateLimitable
{
    public function getRateLimitInfo(): array { /* ... */ }
    public function updateRateLimitInfo(array $data): void { /* ... */ }
    public function calculateWaitTime(float $requestedQueryCost): float { /* ... */ }
    public function waitIfNecessary(float $requestedQueryCost): void { /* ... */ }
}

$client = GraphQLClient::factory()->create($authenticator, new CustomRateLimitService());
```

Configuration
-------------

[](#configuration)

```
// config/shopify-graphql.php
return [
    // Shopify API version (format: YYYY-MM)
    'api_version' => env('SHOPIFY_API_VERSION', '2025-01'),

    // Fail immediately when throttled (vs. waiting and retrying)
    'fail_on_throttled' => env('SHOPIFY_FAIL_ON_THROTTLED', true),

    // Max retry attempts when throttled
    'throttle_max_tries' => env('SHOPIFY_THROTTLE_MAX_TRIES', 5),
];
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Luminarix Labs](https://github.com/luminarix)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance80

Actively maintained with recent releases

Popularity30

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 88.5% 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 ~22 days

Recently: every ~35 days

Total

27

Last Release

168d ago

Major Versions

v0.4.0 → v1.0.02024-07-10

v1.3.0 → v2.0.0-rc12024-11-24

v2.1.0 → v3.0.02024-12-16

v3.2.1 → v4.0.02025-12-02

### Community

Maintainers

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

---

Top Contributors

[![xHeaven](https://avatars.githubusercontent.com/u/14284867?v=4)](https://github.com/xHeaven "xHeaven (115 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (9 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")

---

Tags

laravelLuminarix Labslaravel-shopify-graphql

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/luminarix-laravel-shopify-graphql/health.svg)

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

###  Alternatives

[vormkracht10/laravel-mails

Laravel Mails can collect everything you might want to track about the mails that has been sent by your Laravel app.

24149.7k](/packages/vormkracht10-laravel-mails)[codebar-ag/laravel-docuware

DocuWare integration with Laravel

1221.1k](/packages/codebar-ag-laravel-docuware)[codebar-ag/laravel-zammad

Zammad integration with Laravel

106.1k](/packages/codebar-ag-laravel-zammad)

PHPackages © 2026

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