Use the Shopify API in Laravel With the Laravel Shopify Package
Published on by Paul Redmond
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:
$shopify = \Signifly\Shopify\Factory::fromConfig(); // Paginate products$cursor = $shopify->paginateProducts(); // returns a Cursor // Get products count$count = $shopify->getProductsCount(); // returns an integer // Get products$products = $shopify->getProducts(); // returns a Collection of ProductResource // Create a product$product = $shopify->createProduct([ 'title' => 'Adidas Shoe, Pink',]); // returns a ProductResource // Get a specific product$product = $shopify->getProduct($productId); // returns a ProductResource // Update a product$product = $shopify->updateProduct($productId, [ 'title' => 'Adidas Shoe, Rose',]); // returns a ProductResource // Deleting a product$shopify->deleteProduct($productId);
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.:
$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.