imemento/http

iMemento HTTP Helper

v8.1.0 2021-07-26 08:44 UTC

README

Build Status Latest Stable Version License Total Downloads

抽象化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