rocket-labs/sellercenter-sdk-php
Composer 安装命令:
composer require rocket-labs/sellercenter-sdk-php
包简介
SellerCenter SDK for PHP
README 文档
README
PHP 5.5 and later.
Composer
You can install the sdk via Composer. Run the following command:
composer require rocket-labs/sellercenter-sdk-php
To use the sdk code, use Composer's autoload:
require_once('vendor/autoload.php');
2) Implemented methods
These methods can be accessed through RocketLabs\SellerCenterSdk\Endpoint\Endpoints class:
- Order endpoint -
Endpoints::order()- GetOrders
- GetOrder
- GetDocument
- GetOrderItems
- SetStatusToCanceled
- SetStatusToPackedByMarketplace
- SetStatusToReadyToShip
All another methods you can call with GenericRequest, for more information please look at this sample for GET-methods or this one for POST-methods.
3) Samples
To understand how to work with the SDK, please look at samples. To make the samples work, change the API settings in samples/config/config.php. You need to set up the SellerCenter URL (only https is supported), your login and API key.
API key can be found in your SellerCenter account under Settings > Manage Users. If a given user has no API key yet, generate it by clicking a corresponding link.
After this you can run any sample and see the real results requests.
Please note, that POST requests could affect on your real products, orders etc. Make sure that SKUs or Order IDs in samples are not intersect with data in your SellerCenter account.
3.1) Generic Samples
You can access every API Method by using the GenericRequest class and the core implementation.
see sample in action
cd samples
php ./genericGetter.php
3.1) Endpoints Samples
For the most important API endpoints the SDK provides facades for simple API usage. See endpoint samples here.
The following code describes the pattern how to use the endpoints implementation:
<?php require __DIR__ . '/vendor/autoload.php'; use RocketLabs\SellerCenterSdk\Core\Client; use RocketLabs\SellerCenterSdk\Core\Configuration; use RocketLabs\SellerCenterSdk\Endpoint\Endpoints; // create client instance with your credetials $client = Client::create(new Configuration(SC_API_URL, SC_API_USER, SC_API_KEY)); // get response for a certain api call with fluent interface: // Endpoints - name of endpoint - api method to call - call($client) $response = Endpoints::order()->getOrder(12)->call($client); // Or, for some complex methods, RequestBuilders can be used, // In such cases API command will have following structure: // Endpoints - name of endpoint - api method to call - some builder's setters - build - call($client) $response = Endpoints::order()->getOrders()->setSorting('created_at', 'ASC')->setLimit(12)->build()->call($client);
see a sample in action
open file of a sample. For example samples/endpoint/order/getOrder.php, and change the variable $orderId to contain order id of your seller.
Then run it in the console:
php ./samples/endpoint/order/getOrder.php
rocket-labs/sellercenter-sdk-php 适用场景与选型建议
rocket-labs/sellercenter-sdk-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 38.48k 次下载、GitHub Stars 达 40, 最近一次更新时间为 2016 年 05 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 rocket-labs/sellercenter-sdk-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 rocket-labs/sellercenter-sdk-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 38.48k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 40
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-05-20