nighten / api-client
Nighten API 客户端
0.1
2020-01-16 12:33 UTC
Requires
- php: >=7.4.0
- ext-json: *
- guzzlehttp/guzzle: ^6.3
- psr/log: ^1.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-20 23:08:41 UTC
README
描述
API 交互库
安装
composer require nighten/api-client
示例
创建客户端
$client = new \Nighten\ApiClient\Client($host);
API 认证
$response = $client->request(new AuthRequest($login, $password)); //return \Nighten\ApiClient\Response\Auth\AuthResponse; $response->getUserId(); //Уникальный идентификатор пользователя $response->getKey(); //Api ключ, для аунтификации в запросах требующих ключ.
需要密钥的请求
$client->setAuthenticationProvider(new DefaultAuthenticationProvider('api-key')); $response = $client->request(...);
许可证
本项目采用 MIT 许可证 - 有关详细信息,请参阅 LICENSE.md 文件