Skip to content
This repository has been archived by the owner on May 26, 2020. It is now read-only.

Latest commit

 

History

History
executable file
·
68 lines (47 loc) · 1.97 KB

README.md

File metadata and controls

executable file
·
68 lines (47 loc) · 1.97 KB

(Unofficial) Simplicate v2 API Client for PHP

Contributing

$ git clone [email protected]:valsplat/simplicate-php-client.git
$ cd simplicate-php-client
$ composer update -o

Installation

$ composer require valsplat/simplicate-php-client

Endpoints

This API client is very much a work in progress and is incomplete at this time. You can only use the Project endpoint. Feel free to create a Pull Request to increase coverage.

Authentication

Authentication is done via providing your account ID and a personal access token:

$connection = new \Valsplat\Simplicate\Connection();
$connection->setApiUrl('https://YOURDOMAIN.simplicate.nl/api/v2');
$connection->setAccessToken('ACCESS_TOKEN');
$connection->setAccountId('ACCOUNT_ID');

Errors

The API client throws two exceptions:

  • \Valsplat\Simplicate\Exceptions\NotFoundException - Entity could not be found
  • \Valsplat\Simplicate\Exceptions\ApiException - Generic Api exception

Basic Usage

Each endpoint is accessible via its own method on the \Valsplat\Simplicate\Simplicate instance. The method name is singular, camelcased:

$simplicate = new \Valsplat\Simplicate\Simplicate($connection);
$simplicate->TaskAssignment();

Generic methods & filters

  • 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.

Usage examples

Authentication and usage examples: example.php

TODO

  • Tests w/ mocked http client
  • Complete endpoint support
  • Automatic marshaling of attributes