programster/harvest-sdk-guzzle-driver

A Guzzle-based message handler for the PHP SDK for the Harvest API.

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

This package is not auto-updated.

Last update: 2024-11-07 01:33:58 UTC


README

A Guzzle-based driver for the Harvest SDK.

Installation

composer require programster/harvest-sdk-guzzle-driver

Example Usage

<?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.";
}