dev-master
9999999-dev https://github.com/valsplat/harvest-php-clientA PHP Client for the Harvest V2 API
MIT
The Requires
- php >=7.1
- guzzlehttp/guzzle ~6.0
by Bjorn Post
by Joris Leker
api php guzzle harvest
Wallogit.com
2017 © Pedro Peláez
A PHP Client for the Harvest V2 API
, (*1)
$ git clone git@github.com:valsplat/harvest-php-client.git $ cd harvest-php-client $ composer update -o
$ composer require valsplat/harvest-php-client
This API client is very much a work in progress and is incomplete at this time. You can only use the Client, Project, Task, TaskAssignment, User and UserAssignment endpoints. Feel free to create a Pull Request to increase coverage., (*2)
Authentication is done via providing your account ID and a personal access token:, (*3)
$connection = new \Valsplat\Harvest\Connection();
$connection->setAccessToken('ACCESS_TOKEN');
$connection->setAccountId('ACCOUNT_ID');
Get your token and account ID here: https://id.getharvest.com/oauth2/access_tokens/new, (*4)
The API client throws two exceptions:, (*5)
\Valsplat\Harvest\Exceptions\NotFoundException - Entity could not be found\Valsplat\Harvest\Exceptions\ApiException - Generic Api exceptionEach endpoint is accessible via its own method on the \Valsplat\Harvest\Harvest instance. The method name is singular, camelcased:, (*6)
$vlak = new \Valsplat\Harvest\Harvest($connection); $vlak->TaskAssignment();
list((array)params) - get a collection of entities. You find the available params per endpoint in the Harvest docs.get((int)id) - get a single entity via its id.create() - create given entity.update() - update given entity.save() - convenience method; calls update() if the entity already exists, create() otherwise.delete() - delete given entity.Authentication and usage examples: example.php, (*7)
A PHP Client for the Harvest V2 API
MIT
api php guzzle harvest