programster/harvest-sdk-guzzle-driver

Harvest API 的 PHP SDK 基于 Guzzle 的消息处理器。

dev-main 2021-03-24 15:12 UTC

This package is not auto-updated.

Last update: 2024-09-12 00:51:08 UTC


README

Harvest SDK 的基于 Guzzle 的驱动程序。

安装

composer require programster/harvest-sdk-guzzle-driver

示例用法

<?php

require_once(__DIR__ . '/vendor/autoload.php');

$guzzleDriver = new \Programster\HarvestGuzzleDriver\Driver();

$harvestClient = new \Programster\Harvest\HarvestClient(
    $harvestAccountId="xxx", 
    $harvestTokenId="xxx", 
    $guzzleDriver
);

$response = $harvestClient->getTimeEntries();

if ($response->getStatusCode() === 200)
{
    $responseObject = json_decode($response->getBody());
    print "Harvest Response: " . print_r($responseObject, true) . PHP_EOL;
}
else
{
    print "Something wen't wrong! Your authentication details are probably incorrect.";
}