edstevo / laravel-shopify-graph
A package for connecting to the Shopify Graph API
Fund package maintenance!
EdStevo
Installs: 162
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/edstevo/laravel-shopify-graph
Requires
- php: ^8.4
- illuminate/contracts: ^11.0||^12.0
- spatie/laravel-data: ^4.19
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.8
- orchestra/testbench: ^10.0.0||^9.0.0
- pestphp/pest: ^4.0
- pestphp/pest-plugin-arch: ^4.0
- pestphp/pest-plugin-laravel: ^4.0
- dev-main
- v1.0.43
- v1.0.42
- v1.0.41
- v1.0.40
- v1.0.39
- v1.0.38
- v1.0.37
- v1.0.36
- v1.0.35
- v1.0.34
- v1.0.33
- v1.0.32
- v1.0.31
- v1.0.30
- v1.0.29
- v1.0.28
- v1.0.27
- v1.0.26
- v1.0.25
- v1.0.24
- v1.0.23
- v1.0.22
- v1.0.21
- v1.0.20
- v1.0.19
- v1.0.18
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
- v1.0.3
- v1.0.2
- v1.0.1
- v1.0.0
This package is auto-updated.
Last update: 2026-02-21 08:36:29 UTC
README
Laravel package for posting Shopify Admin GraphQL queries/mutations with typed input DTOs.
Installation
composer require edstevo/laravel-shopify-graph
Publish config:
php artisan vendor:publish --tag=shopify-graph-config
Published config:
return [ 'enabled' => env('SHOPIFY_ENABLED', true), ];
API Versioning
The Shopify API version is intentionally hardcoded in the package (2026-01).
When upgrading Shopify API versions, this package should release a new major version.
Usage
Facade
use EdStevo\LaravelShopifyGraph\Facades\LaravelShopifyGraph; $response = LaravelShopifyGraph::post( 'your-shop.myshopify.com', 'access_token', 'query { shop { name } }', [] // optional variables );
Connection Class
$response = app(\EdStevo\LaravelShopifyGraph\LaravelShopifyGraphConnection::class)->post( 'your-shop.myshopify.com', 'access_token', 'query { shop { name } }', [] // optional variables );
Request Class
use EdStevo\LaravelShopifyGraph\LaravelShopifyGraphRequest; class CreateBlogArticleRequest extends LaravelShopifyGraphRequest { public function __construct(public BlogArticle $article) {} public function query(): string { return ' mutation CreateArticle($article: ArticleCreateInput!) { articleCreate(article: $article) { article { id } userErrors { code field message } } } '; } public function variables(): array { return [ 'article' => ArticleCreateInput::from($this->article->toShopifyPayload())->toArray(), ]; } public function transformResponse(array $data): mixed { return $data['articleCreate']['article']['id'] ?? null; } } $request = new CreateBlogArticleRequest(BlogArticle::first()); $shopifyId = $request->post('your-shop.myshopify.com', 'access_token');
Queue Job Class (recommended for mutations)
use EdStevo\LaravelShopifyGraph\LaravelShopifyGraphJob; use Illuminate\Contracts\Queue\ShouldQueue; class CreateBlogArticleJob extends LaravelShopifyGraphJob implements ShouldQueue { public function __construct( public BlogArticle $article, public string $shopDomain, public string $accessToken ) {} public function getShopDomain(): string { return $this->shopDomain; } public function getAccessToken(): string { return $this->accessToken; } public function query(): string { return ' mutation CreateArticle($article: ArticleCreateInput!) { articleCreate(article: $article) { article { id } userErrors { code field message } } } '; } public function variables(): array { return [ 'article' => ArticleCreateInput::from($this->article->toShopifyPayload())->toArray(), ]; } public function handleResponse(array $data): void { $this->article->update([ 'shopify_id' => $data['articleCreate']['article']['id'] ?? null, ]); } } CreateBlogArticleJob::dispatch(BlogArticle::first(), 'your-shop.myshopify.com', 'access_token');
For synchronous execution:
CreateBlogArticleJob::dispatchSync(BlogArticle::first(), 'your-shop.myshopify.com', 'access_token');
Testing
composer test
Changelog
See CHANGELOG.
Credits
License
MIT.