This is an unofficial FreeAgent PHP Client Library provides a simple PHP interface for the FreeAgent API 2.0 (https://dev.freeagent.com/docs). It is a fork from nickheppleston repository
Basic OAuth support is provided, however this API assumes you have already exchanges tokens and have a 'Refresh Token'. For more information, see https://dev.freeagent.com/docs/oauth/.
This API is a read only one.
The API currently supports the following functionality of the FreeAgent API v2:
- Invoices
- Contacts
- Projects
- Category
- Bank Accounts & explanations
- Do the quickstart for FreeAgent API 2.0 to obtain access token : https://dev.freeagent.com/docs/quick_start
- Copy paste the access token into "config.inc.php"
- Use the api !
Example 1 : Get one element
$invoice = new Invoice('https://api.freeagent.com/v2/invoices/4');
echo $invoice->net_value;
Example 2 : Get all elements
$cats = new Categories();
$categories = $cats->getAll();
$i = new Invoices();
$is = $i->getAll();
foreach($is as $i)
{
// $i is an Invoice object
$contact = $i->getContact();
}
TODO. Talk about "model/Base.php" & "Manager.php"
- Unit testing
- Manage all objects (tasks, ...)
- Automatic Date casting when it is a date + getters / setters
- Attachment management