canaltp/tyr-component
Composer 安装命令:
composer require canaltp/tyr-component
包简介
PHP library which makes curl calls to Tyr API.
README 文档
README
PHP library which makes curl calls to Tyr API.
Supports Guzzle3 and Guzzle5 since version 1.2.
Composer
Install via composer
{ "require": { "canaltp/tyr-component": "~1.2" } }
Usage
Instanciate TyrService as a plain PHP object:
$tyrUrl = 'http://tyr.dev.canaltp.fr/v0/'; $endPointId = 2; // Instanciating api $tyrApi = new CanalTP\TyrComponent\TyrService($tyrUrl, $endPointId); // For Guzzle5 $tyrApi = new CanalTP\TyrComponent\Guzzle3\TyrService($tyrUrl, $endPointId); // For Guzzle3 // Creating request $user = $tyrApi->createUser('email', 'login'); // Get last Guzzle response instance (usefull to get status code...) $response = $tyrApi->getLastResponse(); $statusCode = $response->getStatusCode();
See full Tyr class.
Testing
Mock Guzzle client:
$tyrUrl = 'http://tyr.dev.canaltp.fr/v0/'; $endPointId = 2; $tyrApi = new CanalTP\TyrComponent\TyrService($tyrUrl, $endPointId); // For Guzzle5 $tyrApi = new CanalTP\TyrComponent\Guzzle3\TyrService($tyrUrl, $endPointId); // For Guzzle3 // Creating GuzzleHttp\Client mock... $tyrApi->setClient($mockedClient);
License
This project is under GPL-3.0 License.
统计信息
- 总下载量: 4.97k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2016-02-25