Use the Shopify API in Laravel With the Laravel Shopify Package


October 14th, 2021


Laravel Shopify is a package to communicate with the Shopify API from Laravel applications. Here are a few examples from the project's documentation overview:

1$shopify = \Signifly\Shopify\Factory::fromConfig();
3// Paginate products
4$cursor = $shopify->paginateProducts(); // returns a Cursor
6// Get products count
7$count = $shopify->getProductsCount(); // returns an integer
9// Get products
10$products = $shopify->getProducts(); // returns a Collection of ProductResource
12// Create a product
13$product = $shopify->createProduct([
14 'title' => 'Adidas Shoe, Pink',
15]); // returns a ProductResource
17// Get a specific product
18$product = $shopify->getProduct($productId); // returns a ProductResource
20// Update a product
21$product = $shopify->updateProduct($productId, [
22 'title' => 'Adidas Shoe, Rose',
23]); // returns a ProductResource
25// Deleting a product

This package covers quite a few endpoints from the API and even provides the ability to make custom requests to the Shopify API, taking care of credentials, etc.:

1$shopify->put('products/{product_id}.json', $payload);

Custom requests return an Illuminate client Response instance, so you can use all the available methods on the response instance you can in any HTTP request using Laravel's client.

The package has API methods for the following high-level Shopify features:

  • Access
  • Analytics
  • Billing
  • Customers
  • Discounts
  • Events
  • Inventory
  • Marketing Events
  • Metafields
  • Online store
  • Orders
  • Plus
  • Products
  • Sales Channel
  • Shipping and Fulfillment
  • Shopify Payments
  • Store properties
  • Tender Transactions

The documentation has a complete list of all the methods with links to official Shopify API parameters and documentation.

You can learn more about this package, get full installation instructions, and view the source code on GitHub.

Filed in:

Paul Redmond

Full stack web developer. Author of Lumen Programming Guide and Docker for PHP Developers.

Laravel News Partners