imemento / http
iMemento HTTP Helper
v8.1.0
2021-07-26 08:44 UTC
Requires
- php: ^8.0
- fideloper/proxy: ^4.2
- guzzlehttp/guzzle: ^7.0
- illuminate/http: ^8.0
- imemento/jwt: ~8.1.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-08-26 20:18:18 UTC
README
抽象化API与客户端之间的通信。它不依赖于任何框架。
安装
composer require imemento/http
用法
Service.php是一个抽象类,由所有其他SDK扩展,并公开有用的REST方法。它在幕后管理服务和用户权限。
use iMemento\Http\Service; // Example: class DestinationsService extends Service { public function getDestinations() { return $this->_get('/destinations'); } } $config = [ 'service_id' => 'destinations', 'endpoint' => 'http://api-destinations.dev/api/v1/', 'host' => 'api-destinations.dev', ]; $destinations = new DestinationsService(Issuer $issuer, array $config); $destinations->getDestinations(); //returns an array of top destinations