Download the PHP package thalia/shopify-rest-to-graphql without Composer

On this page you can find all versions of the php package thalia/shopify-rest-to-graphql. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package shopify-rest-to-graphql

Shopify REST to GraphQL (PHP/Laravel 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

Table of Contents

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

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

Publish the configuration file:

Usage

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

Example Usage for calling graphql query

  1. Basic Query Without Variables

  2. Query With Variables

Authentication & Expiring Offline Access Tokens

Shopify is replacing non-expiring offline access tokens with expiring ones. Public apps created before 2026-04-01 must migrate by 2027-01-01, after which requests for non-expiring tokens will error. Custom and merchant-created apps are exempt. See the Shopify docs.

This package is stateless — it acquires/refreshes tokens but never stores them. Your app owns persistence. To support expiring tokens, add these columns to your per-shop token storage: expires_at, refresh_token, refresh_token_expires_at (alongside access_token).

New installs — acquire an expiring token on the OAuth callback:

The legacy getAccessToken($code) (non-expiring, returns a bare token string) is unchanged and still works, but new installs should use getExpiringAccessToken().

Before each use — refresh proactively if near expiry:

refreshOfflineAccessToken() returns a new access token and a new refresh token — persist both before using them. The old refresh token stays usable only until the earliest of: the new one is used, a new token is acquired, 30 days after its first use, or its original 90-day expiry. On an HTTP 401 (a GraphqlException where $e->isUnauthorized() is true), refresh once and retry. If the refresh itself returns 401, or refresh_token_expires_at (90 days) has passed, the merchant must relaunch/reinstall the app. Transient 429/5xx failures are safe to retry with backoff. Don't refresh and acquire a token (code grant / token exchange) concurrently for the same shop — each retires the other's result.

Embedded apps — exchange the App Bridge ID token (token exchange):

A 400 means the ID token is stale (they live ~1 minute) — get a fresh one from App Bridge and retry.

Existing merchants — migrate a non-expiring token once (irreversible):

Run the migration once per shop — from a background/batch job or lazily on the next app launch.

GraphqlService Class

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

Available Methods

General GraphQL

Products

Variants

Other

Example: Creating a Product

Example: Updating a Product

Example: Getting Products

Example: Add Product Image

Example: Delete Product Image

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

Variants

Collections

Orders

getOrders() and getOrder() accept an optional fields array holding the GraphQL selection to request. Omit it (or pass an empty array) to use the package default, which covers every key the REST-shaped response exposes:

Pass your own fields to fetch less and keep the query cheap - only the keys you request are populated in the response:

Inventory

ApplicationCharges

Metafields

Fulfillments

Webhooks

Themes

Other Endpoints

Additional endpoint classes include:

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.

All versions of shopify-rest-to-graphql with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
guzzlehttp/guzzle Version >=7.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package thalia/shopify-rest-to-graphql contains the following files

Loading the files please wait ...