nighten/api-client

Nighten API 客户端

0.1 2020-01-16 12:33 UTC

This package is auto-updated.

Last update: 2024-09-20 23:08:41 UTC


README

Latest Stable Version Build Status Scrutinizer Code Quality Code Coverage License

描述

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 文件