oxy-coach/aliexpress-api-client-local
Composer 安装命令:
composer require oxy-coach/aliexpress-api-client-local
包简介
API client implementation for new AliExpress API version.
关键字:
README 文档
README
AliExpress API client for new API version
API client implementation for AliExpress local API.
Usage
- This library uses
php-http/httplugunder the hood. If you don't want to bother with details, just install library and it's dependencies via Composer:
composer require php-http/curl-client nyholm/psr7 php-http/message retailcrm/aliexpress-top-client
Details about those third-party libraries and why you need to install them can be found here.
- Instantiate client using
ClientFactory:
use Simla\Component\AppData; use Simla\Factory\ClientFactory; $client = ClientFactory::createClient( AppData::ENDPOINT, 'your jwt token' );
- Create and fill request data. All requests and responses use the same naming. Requests live under
RetailCrm\Model\Requestnamespace, and responses can be found in theRetailCrm\Model\Responsenamespace. For example, you can instantiate an order list request with this code:
use Simla\Model\Request\GetOrderListRequest; $request = new GetOrderListRequest();
- Send request using
Client::sendRequestlike this:
/** @var \Simla\Model\Response\GetOrderListResponse $response */ $response = $client->sendRequest(new GetOrderListRequest());
Each request uses provided jwt token for authorization.
Friendly note. Use response type annotations. Both client methods which returns responses actually returns ResponseInterface (not the PSR one). Actual response type will be determined by the request model. Your IDE will not recognize any response options unless you put a proper type annotation for the response variable.
Customization
This library uses Container pattern under the hood. You can pass additional dependencies using ContainerBuilder. For example:
use Http\Client\Curl\Client; use Simla\Component\AppData; use Simla\Component\Environment; use Nyholm\Psr7\Factory\Psr17Factory; use Simla\Builder\ClientBuilder; use Simla\Builder\ContainerBuilder; use Simla\Component\Logger\StdoutLogger; $client = new Client(); $logger = new StdoutLogger(); $factory = new Psr17Factory(); $appData = new AppData(AppData::ENDPOINT, 'jwt token'); $container = ContainerBuilder::create() ->setEnv(Environment::TEST) ->setClient($client) ->setLogger($logger) ->setStreamFactory($factory) ->setRequestFactory($factory) ->setUriFactory($factory) ->build(); $client = ClientBuilder::create() ->setContainer($container) ->setAppData($appData) ->build();
Logger should implement Psr\Log\LoggerInterface (PSR-3), HTTP client should implement Psr\Http\TopClient\TopClientInterface (PSR-18), HTTP objects must be compliant to PSR-7.
You can use your own container if you want to - it must be compliant to PSR-11. This is strongly discouraged because it'll be much easier to just integrate library with your own application, and your own DI system.
The simplest example of client initialization without using ClientFactory looks like this:
use Simla\Component\AppData; use Simla\Builder\ClientBuilder; use Simla\Builder\ContainerBuilder; $appData = new AppData(AppData::ENDPOINT, 'jwt token'); $client = ClientBuilder::create() ->setContainer(ContainerBuilder::create()->build()) ->setAppData($appData) ->build();
In fact, ClientFactory works just like this under the hood.
oxy-coach/aliexpress-api-client-local 适用场景与选型建议
oxy-coach/aliexpress-api-client-local 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 44 次下载、GitHub Stars 达 0, 最近一次更新时间为 2022 年 07 月 27 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「rest」 「api」 「retailCRM」 「Aliexpress」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 oxy-coach/aliexpress-api-client-local 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 oxy-coach/aliexpress-api-client-local 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 oxy-coach/aliexpress-api-client-local 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP client for RetailCRM API
URL validator for RetailCRM
PHP client for MG Bot API
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
PHP client for RetailCRM API
统计信息
- 总下载量: 44
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-07-27