Use the Shopify API in Laravel With the Laravel Shopify Package
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(); 2 3// Paginate products 4$cursor = $shopify->paginateProducts(); // returns a Cursor 5 6// Get products count 7$count = $shopify->getProductsCount(); // returns an integer 8 9// Get products10$products = $shopify->getProducts(); // returns a Collection of ProductResource11 12// Create a product13$product = $shopify->createProduct([14 'title' => 'Adidas Shoe, Pink',15]); // returns a ProductResource16 17// Get a specific product18$product = $shopify->getProduct($productId); // returns a ProductResource19 20// Update a product21$product = $shopify->updateProduct($productId, [22 'title' => 'Adidas Shoe, Rose',23]); // returns a ProductResource24 25// Deleting a product26$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.:
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.
0 comments:
Post a Comment
Thanks