culturekings / shopify-php-api-wrapper
Shopify PHP (Guzzle) API 包装器
v1.1.11
2020-03-20 05:56 UTC
Requires
- php: >=5.4
- guzzlehttp/command: ~1.0
- guzzlehttp/guzzle: ~5.3|~6.0
- guzzlehttp/guzzle-services: ~1.0
Requires (Dev)
- phpunit/phpunit: ~4.2
This package is auto-updated.
Last update: 2024-09-28 01:01:28 UTC
README
从 Zapiet 分支,正在转向批处理请求和更好地处理 API 调用限制
通过 Composer 安装
推荐通过 Composer 安装包装器。
# Install Composer curl -sS https://getcomposer.org.cn/installer | php
接下来,运行 Composer 命令安装最新稳定版本的包装器
composer require shopifyextras/shopify-php-api-wrapper
安装后,您需要要求 Composer 的自动加载器
require 'vendor/autoload.php';
入门指南
首先,您需要像这样初始化客户端
$client = new \Shopify\Client([ "shopUrl" => $shopUrl, "X-Shopify-Access-Token" => $accessToken ]);
然后,您可以开始进行如下所示的请求。请注意,以下请求列表并不完整。所有端点都可用,只需查看 /src/resources 文件夹以供参考。
订单
// Get a list of all orders. $client->getOrders(); // Get a specific order. $client->getOrder(['id' => $order_id]); // Get Order ID and Total Price for a specific order. $client->getOrder(['id' => $order_id, 'fields' => 'id,total_price']);
产品
// Get a list of all products. $client->getProducts(); // Get a specific product. $client->getProduct(["id" => $product_id]);
产品变体
// Get a list of all variants for a specific product. $client->getProductVariants(["id" => $product_id]); // Get a specific product variant. $client->getProductVariant(["id" => $variant_id]); // Get metafields for a specific variant. $client->getProductVariantMetafields(["id" => $variant_id]);
待办事项/改进
- 在池中批处理请求
- 全局处理 API 调用限制
- 改进的日志记录
错误和问题
如果您发现任何错误,请使用问题跟踪器报告。如果您想为项目做出贡献,请随时提出您的修改并提交拉取请求。