PHPackages                             thalia/shopify-rest-to-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. thalia/shopify-rest-to-graphql

ActiveLibrary

thalia/shopify-rest-to-graphql
==============================

Shopify REST to GraphQL : Converts Shopify REST API payloads to GraphQL queries with minimal changes for seamless Laravel integration.

1.0.2(1y ago)51.2k9[1 issues](https://github.com/pawan1793/shopify-rest-to-graphql/issues)MITPHPPHP &gt;=7.4

Since Feb 20Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/pawan1793/shopify-rest-to-graphql)[ Packagist](https://packagist.org/packages/thalia/shopify-rest-to-graphql)[ RSS](/packages/thalia-shopify-rest-to-graphql/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (5)Dependencies (1)Versions (3)Used By (0)

Shopify REST to GraphQL (PHP/Laravel Package)
=============================================

[](#shopify-rest-to-graphql-phplaravel-package)

This package designed to help developers migrate from Shopify's REST API to the more modern and efficient GraphQL API. The package provides a set of utility functions and endpoints that map REST API functionality to GraphQL queries and mutations, making it easier to transition your Laravel application to use Shopify's GraphQL API. NOTE : This is experimental package

Features
--------

[](#features)

- Easy Integration: Simplifies the integration of Shopify's GraphQL API into your Laravel application.
- Minimal Changes: Converts Shopify REST API payloads to GraphQL with minimal modifications, reducing development time and effort.

Table of Contents
-----------------

[](#table-of-contents)

- [Overview](#overview)
- [Installation](#installation)
- [Usage](#usage)
- [GraphqlService Class](#graphqlservice-class)
- [Endpoints](#endpoints)
    - [Products](#products)
    - [Variants](#variants)
    - [Collections](#collections)
    - [Orders](#orders)
    - [Inventory](#inventory)
    - [ApplicationCharges](#applicationcharges)
    - [Metafields](#metafields)
    - [Fulfillments](#fulfillments)
    - [Webhooks](#webhooks)
    - [Themes](#themes)
    - [Other Endpoints](#other-endpoints)
- [Contributing](#contributing)

Overview
--------

[](#overview)

Shopify's GraphQL API offers several advantages over the REST API, including more efficient data fetching, fewer requests, and more flexible queries. This Laravel package provides a seamless way to transition from the REST API to GraphQL by offering utility functions and endpoints that mimic REST API behavior but use GraphQL under the hood.

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

[](#installation)

To install the package in your Laravel application, follow these steps:

```
composer require thalia/shopify-rest-to-graphql
```

Publish the configuration file:

```
php artisan vendor:publish --provider="Thalia\ShopifyRestToGraphql\ShopifyRestToGraphqlServiceProvider"
```

Usage
-----

[](#usage)

The package provides a GraphqlService class with methods to handle various Shopify GraphQL operations.

```
use Thalia\ShopifyRestToGraphql\GraphqlService;

$shopifyGraphql = new GraphqlService($shop, $accessToken);
$product = $shopifyGraphql->graphqlPostProduct($params);
print_r($product);
```

Example Usage for calling graphql query

1. Basic Query Without Variables

    ```
    $query = 'query { shop { name email } }';
    $variables = [];

    $response = $shopifyGraphql->graphqlQueryThalia($query, $variables);

    if (isset($response['errors'])) {
        echo "Error: " . $response['errors']['message'];
    } else {
        print_r($response);
    }
    ```
2. Query With Variables

    ```
    $query = 'mutation createProduct($title: String!) { productCreate(input: { title: $title }) { product { id      title } } }';

    $variables = [
        'title' => 'New Product'
    ];

    $response = $shopifyGraphql->graphqlQueryThalia($query, $variables);

    if (isset($response['errors'])) {
        echo "Error: " . $response['errors']['message'];
    } else {
        print_r($response);
    }
    ```

GraphqlService Class
--------------------

[](#graphqlservice-class)

The `GraphqlService` class is the core of this package and provides direct interaction with Shopify's GraphQL API.

### Available Methods

[](#available-methods)

#### General GraphQL

[](#general-graphql)

- `graphqlQueryThalia(string $query, array $variables = [])`: Execute any GraphQL query with optional variables
- `graphQLQuery($query, $shop, $accessToken)`: Alternative method to execute GraphQL queries with different credentials

#### Products

[](#products)

- `graphqlPostProduct($params)`: Create a new product
- `graphqlPostProductWithVariants($params)`: Create a product with multiple variants
- `graphqlUpdateProduct($params)`: Update an existing product
- `graphqlGetProducts($params)`: Get a list of products with filtering options
- `graphqlGetProductsCount()`: Get the total count of products
- `graphqlGetProduct($shopifyid)`: Get a single product by ID
- `graphqlGetProductWithoutInventory($shopifyid)`: Get a product without inventory information
- `graphqlDeleteProduct($shopifyid)`: Delete a product
- `graphqlCheckProductOnShopify($shopifyid)`: Check if a product exists on Shopify
- `reOrderProductImages($params)`: Reorder product images
- `graphqlCreateProductImage($images, $productShopifyId)`: Add Product Image
- `graphqlDeleteProductImage(imageIds, $productShopifyId)`: Delete Product Image

#### Variants

[](#variants)

- `graphqlDeleteVariant($shopifyid, $variantid)`: Delete a variant
- `graphqlGetProductVariants($shopifyid)`: Get all variants for a product
- `graphqlGetVariant($variantid)`: Get a single variant by ID
- `getProductIdFromVairant($variantid)`: Get product ID that a variant belongs to
- `graphqlUpdateVariant($shopifyId, $variantId, $params)`: Update a variant

#### Other

[](#other)

- `getCollectionHandle($collection_id)`: Get a collection's handle by ID

### Example: Creating a Product

[](#example-creating-a-product)

```
$productData = [
    'product' => [
        'title' => 'New Product',
        'body_html' => 'Product description',
        'vendor' => 'My Vendor',
        'product_type' => 'Clothing',
        'tags' => 'tag1,tag2',
        'variants' => [
            [
                'price' => '19.99',
                'sku' => 'SKU123',
                'inventory_management' => 'shopify'
            ]
        ],
        'images' => [
            [
                'src' => 'https://example.com/image.jpg',
                'alt' => 'Product Image'
            ]
        ]
    ]
];

$response = $shopifyGraphql->graphqlPostProduct($productData);
```

### Example: Updating a Product

[](#example-updating-a-product)

```
$updateData = [
    'product' => [
        'id' => '1234567890',
        'title' => 'Updated Product Title',
        'tags' => 'updated,tags',
        'variants' => [
            [
                'id' => '9876543210',
                'price' => '29.99'
            ]
        ]
    ]
];

$response = $shopifyGraphql->graphqlUpdateProduct($updateData);
```

### Example: Getting Products

[](#example-getting-products)

```
$params = [
    'limit' => 10,
    'vendor' => 'Example Vendor',
    'published_status' => 'published',
    'fields' => 'id,title,variants,tags'
];

$products = $shopifyGraphql->graphqlGetProducts($params);
```

### Example: Add Product Image

[](#example-add-product-image)

```
        $images = [
            [
                'url' => 'https://fastly.picsum.photos/id/365/200/300.jpg?hmac=n_4DxqK0o938eabBZRnEywWtPwgF2MKoTfnRmJ7vlKQ',
                'alt' => 'lorem ipsum',
            ]
        ];

$response = $shopifyGraphql->graphqlCreateProductImage($images, $productShopifyId);
```

### Example: Delete Product Image

[](#example-delete-product-image)

```
        $imageIds = [
            "4145546145154","5456564465234",
        ];

$response = $shopifyGraphql->graphqlDeleteProductImage($imageIds, $productShopifyId);
```

Endpoints
---------

[](#endpoints)

The package provides endpoint classes that map to different Shopify resources. Each endpoint class offers methods that correspond to REST API operations but utilize GraphQL under the hood.

### Products

[](#products-1)

```
use Thalia\ShopifyRestToGraphql\Endpoints\ProductsEndpoints;

$productsEndpoint = new ProductsEndpoints($shop, $accessToken);
```

- `getProducts($params)`: Get a list of products with filtering options
- `getProduct($productId)`: Get a single product by ID
- `productVariantsCount()`: Get the total count of product variants
- `deleteAllProductImages($productId)`: Delete all images for a product

### Variants

[](#variants-1)

```
use Thalia\ShopifyRestToGraphql\Endpoints\VariantsEndpoints;

$variantsEndpoint = new VariantsEndpoints($shop, $accessToken);
```

- `productVariantsBulkUpdate($shopifyId, $variantId, $params)`: Update a variant
- `productVariantsBulkDelete($shopifyId, $variantId)`: Delete a variant

### Collections

[](#collections)

```
use Thalia\ShopifyRestToGraphql\Endpoints\CollectionsEndpoints;

$collectionsEndpoint = new CollectionsEndpoints($shop, $accessToken);
```

- `getSmartCollections()`: Get a list of smart collections
- `getCollection($collectionId)`: Get a single collection by ID
- `getCustomCollections()`: Get a list of custom collections

### Orders

[](#orders)

```
use Thalia\ShopifyRestToGraphql\Endpoints\OrdersEndpoints;

$ordersEndpoint = new OrdersEndpoints($shop, $accessToken);
```

- `getOrders($params)`: Get a list of orders with filtering options
- `getOrder($orderId)`: Get a single order by ID
- `createOrder($params)`: Create a new order
- `updateOrder($orderId, $params)`: Update an existing order
- `cancelOrder($orderId, $params)`: Cancel an order
- `closeOrder($orderId)`: Close an order
- `reopenOrder($orderId)`: Reopen a closed order

### Inventory

[](#inventory)

```
use Thalia\ShopifyRestToGraphql\Endpoints\InventoryEndpoints;

$inventoryEndpoint = new InventoryEndpoints($shop, $accessToken);
```

- `getInventoryLevels($params)`: Get inventory levels
- `adjustInventoryLevel($params)`: Adjust inventory level
- `getInventoryItem($inventoryItemId)`: Get inventory item by ID
- `updateInventoryItem($inventoryItemId, $params)`: Update inventory item

### ApplicationCharges

[](#applicationcharges)

```
use Thalia\ShopifyRestToGraphql\Endpoints\ApplicationChargesEndpoints;

$chargesEndpoint = new ApplicationChargesEndpoints($shop, $accessToken);
```

- `appPurchaseOneTimeCreate($params)`: Create a one-time application charge
- `currentAppInstallationForOneTime($chargeId)`: Get details of a one-time charge

### Metafields

[](#metafields)

```
use Thalia\ShopifyRestToGraphql\Endpoints\MetafieldsEndpoints;

$metafieldsEndpoint = new MetafieldsEndpoints($shop, $accessToken);
```

- `getMetafields($params)`: Get metafields
- `getMetafield($metafieldId)`: Get a single metafield
- `createMetafield($params)`: Create a metafield
- `updateMetafield($metafieldId, $params)`: Update a metafield
- `deleteMetafield($metafieldId)`: Delete a metafield

### Fulfillments

[](#fulfillments)

```
use Thalia\ShopifyRestToGraphql\Endpoints\FulfillmentsEndpoints;

$fulfillmentsEndpoint = new FulfillmentsEndpoints($shop, $accessToken);
```

- `createFulfillment($params)`: Create a fulfillment
- `updateFulfillment($fulfillmentId, $params)`: Update a fulfillment
- `getFulfillment($fulfillmentId)`: Get a single fulfillment
- `cancelFulfillment($fulfillmentId)`: Cancel a fulfillment

### Webhooks

[](#webhooks)

```
use Thalia\ShopifyRestToGraphql\Endpoints\WebhooksEndpoints;

$webhooksEndpoint = new WebhooksEndpoints($shop, $accessToken);
```

- `createWebhook($params)`: Create a webhook
- `getWebhooks($params)`: Get webhooks
- `getWebhook($webhookId)`: Get a single webhook
- `updateWebhook($webhookId, $params)`: Update a webhook
- `deleteWebhook($webhookId)`: Delete a webhook

### Themes

[](#themes)

```
use Thalia\ShopifyRestToGraphql\Endpoints\ThemesEndpoints;

$themesEndpoint = new ThemesEndpoints($shop, $accessToken);
```

- `getThemes()`: Get all themes
- `getTheme($themeId)`: Get a single theme
- `createTheme($params)`: Create a new theme
- `updateTheme($themeId, $params)`: Update a theme
- `deleteTheme($themeId)`: Delete a theme

### Other Endpoints

[](#other-endpoints)

Additional endpoint classes include:

- `ShopEndpoints`: Shop-related operations
- `LocationsEndpoints`: Location management
- `DiscountsEndpoints`: Discount operations
- `ScriptTagsEndPoints`: Script tag operations
- `RecurringApplicationChargesEndpoints`: Recurring charge operations
- `OauthEndpoints`: OAuth operations
- `OauthScopeEndpoints`: OAuth scope operations
- `ShippingEndpoints`: Shipping operations

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

[](#contributing)

We welcome contributions! To contribute:

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

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance65

Regular maintenance activity

Popularity25

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor1

Top contributor holds 66.7% 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 ~63 days

Total

2

Last Release

382d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/156f5cf6ab72914790420f305c6e6d64782dc9dbc94512e49657fc199c4722e6?d=identicon)[pawan1793](/maintainers/pawan1793)

---

Top Contributors

[![pawan1793](https://avatars.githubusercontent.com/u/8011942?v=4)](https://github.com/pawan1793 "pawan1793 (168 commits)")[![mohammedThaliaTechnologies](https://avatars.githubusercontent.com/u/195870949?v=4)](https://github.com/mohammedThaliaTechnologies "mohammedThaliaTechnologies (56 commits)")[![rushabh-thalia](https://avatars.githubusercontent.com/u/195726894?v=4)](https://github.com/rushabh-thalia "rushabh-thalia (16 commits)")[![patilsayali15](https://avatars.githubusercontent.com/u/198902169?v=4)](https://github.com/patilsayali15 "patilsayali15 (9 commits)")[![MFurkanBabur](https://avatars.githubusercontent.com/u/7117412?v=4)](https://github.com/MFurkanBabur "MFurkanBabur (2 commits)")[![Riddhi-Thalia](https://avatars.githubusercontent.com/u/209581052?v=4)](https://github.com/Riddhi-Thalia "Riddhi-Thalia (1 commits)")

### Embed Badge

![Health badge](/badges/thalia-shopify-rest-to-graphql/health.svg)

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

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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