tamkeen-tms/rest-client
Composer 安装命令:
composer require tamkeen-tms/rest-client
包简介
PHP REST client for Tamkeen's API (tamkeentms.com)
README 文档
README
What is this?
This is the official PHP client for Tamkeen's REST API. You can use this in your PHP applications to communicate with Tamkeen. Before you start you need to acquire an the "Tenant id" and the secret auth "key"; you can find this info under Administration > API.
Installation
You can require this library into your project using composer, via the following command:
composer require tamkeen-tms/rest-client
Next, you will be able to use it inside your project through the namespace Tamkeen
How it works
This library merely sends requests to Tamkeen's API endpoints. So, you need to know what endpoints are available and how to pick the correct one! A list of the endpoints are available on Tamkeen's website.
Creating a client
Before sending requests you need to initiate a new "Client" instance, and pass it the "Tenant" and authorization key. Through this client you will be able to make the requests. Each "Request" must be made through a "Client". You can instantiate multiple clients to make requests to multiple copies of the application!
$client = new Tamkeen\Client([tenant], [secret key]) // New client instance
Sending a request
Using the created client you can now send new requests, for example:
$request = new Tamkeen\Request($client, 'GET', 'branches'); // Create the request $response = $request->send();
You need to call ->send(), which will send the request to the application and return the response. The response will be in JSON format.
Examples:
Here is an example for fetching the branches list:
try{ $request = $client->request('get', 'branches'); // Create the request $response = $request->send(); // Send it, returns the response }catch(RequestException $e){ /** * Possible error messages include: * tenant_not_identified: The tenant id was not provided, or invalid * api_disabled: API is disabled for the tenant. (Contact the support team to enable it). * api_key_missing: The authentication key missing. * api_key_invalid: The authentication key is invalid. * api_error: An error happened at the API's level; server error (500). **/ }
The $response in this case would return:
{
"branches": [{
"id": 1,
"name": "Headquarters",
"code": "HQ"
"currency": "USD"
}]
}
For any further questions please feel free to create a new issue here.
tamkeen-tms/rest-client 适用场景与选型建议
tamkeen-tms/rest-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 21 次下载、GitHub Stars 达 1, 最近一次更新时间为 2021 年 05 月 22 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「rest」 「api」 「lms」 「tms」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tamkeen-tms/rest-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tamkeen-tms/rest-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tamkeen-tms/rest-client 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A PSR-7 compatible library for making CRUD API endpoints
Api bundle
Alfabank REST API integration
A Flickr wrapper to allow you to call the Flickr api with Guzzle as the backend.Goal is to have 100% Flickr api coverage rather than just upload/display photos (currently at 23%).
BlockCypher's PHP SDK for REST API
Helper classes for creating cookie headers
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-05-22