wearerequired / harvest-api-php-client

Harvest REST API 的 PHP 客户端库。


README

Latest Stable Version Latest Unstable Version Total Downloads CI codecov

这是对 Harvest REST API v2 的一个出色的面向对象包装器,用现代 PHP 编写。

安装

通过 Composer

composer require wearerequired/harvest-api-php-client php-http/guzzle7-adapter

为什么选择 php-http/guzzle7-adapter?该库借助 HTTPlug 与任何 HTTP 消息客户端解耦。

基本用法

// Include Composer's autoloader.
require_once __DIR__ . '/vendor/autoload.php';

// Set up the client.
$client = new \Required\Harvest\Client();
$client->authenticate( 'account-id', 'token' );

// Do your API calls.
$currentUser = $client->currentUser()->show();

// Example request with auto paging.
$projects = $client->projects()->allWithAutoPagingIterator();
foreach ( $projects as $project ) {
	// Do something with $project. The iterator will automatically
	// fetch new entries if the end of a page is reached.
}

OAuth

此库不包含 OAuth 2.0 客户端。我们建议使用 PHP League 的 OAuth 2.0 客户端,结合 我们为 Harvest 提供的 OAuth 提供者

许可证

MIT 许可证 (MIT)。有关更多信息,请参阅 许可证文件


a required open source product - let's get in touch