niklan/dellin-api
Composer 安装命令:
composer require niklan/dellin-api
包简介
PHP SDK for Dellin API.
README 文档
README
What is it?
A PHP library which implements API for https://dev.dellin.ru.
Installation
PHP 7.2+ as minimum requirement because of use new features.
Install package via compose:
$ composer require niklan/dellin-api
Documentation
Examples
The library is just a set of PHP wrappers to destination endpoints for Dellin.
Currently library supports only json format. There is no decoder and encoder for XML and I have not future plans to implement it.
Public API auth
The minimum required authentication at dev.dellin.ru is appkey, which is represented by AppkeyAuth.
$auth = new AppkeyAuth('MY-DELLIN-APPKEY');
Session Auth
This authentication method used for some "client specific" API's that requires sessionID.
$auth = new SessionAuth('MY-DELLIN-APPKEY', 'SESSION-TOKEN-ID');
Build a Client
For sending request it's need to be isntantiated HttpClient representation. It requires you to pass one of two authentication methods. They will be used during request sending.
$client = new HttpClient($auth);
Send request
You can send request to any Dellin api by using request() method from $client.
In first argument you pass API endpoint without base uri and format, and in second your params.
// @see https://dev.dellin.ru/api/auth/login/ $response = $client->request('/v1/customers/login', ['login' => 'example', 'password' => '123']); $result = $response->getResult();
Send request using PHP wrapper.
Wrappers for endpoints is simple and just collect data to send in more friendly way.
The request above using wrapper:
$request = new Login('example' , '123'); $response = $client->execute($request); $result = $response->getResult();
In that way:
- You don't need to handle endpoints every time. You just use semantic object.
- All required by an API params will be required by object constructor, so you don't miss something.
- All optional params set by setters.
It's better to implement php-http.org with PSR-18 in 2.x verions, if it will be created.
niklan/dellin-api 适用场景与选型建议
niklan/dellin-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 785 次下载、GitHub Stars 达 1, 最近一次更新时间为 2019 年 10 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 niklan/dellin-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 niklan/dellin-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 785
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2019-10-07