Use the Shopify API in Laravel With the Laravel Shopify Package
Published on by Paul Redmond
$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.:
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:
- Marketing Events
- Online store
- 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.