freeagent-php
, (*1)
This is a PHP library that provides a comprehensive wrapper for the Freeagent v2 API., (*2)
Installation
You can install this library via Composer:, (*3)
composer require 6by6/freeagent-php
, (*4)
Compatibility
We are currently testing against the following PHP versions:
* '5.6'
* '7.0'
* hhvm
* nightly, (*5)
Unit Tests
Phpunit tests are provided with the library, however, we would strongly
recommend NOT executing these against your live account. The tests
require a clean account and part of the process involves deleting any
data before starting i.e. everything about your business., (*6)
The test suite will attempt to ensure you are not using a live account before
executing tests, however, we will not be held responsible for any loss of
data., (*7)
If you're just getting started we would recommend using a sandbox
account (obtainable via the Freeagent API Quickstart Guide)., (*8)
Getting Started
Get a list of invoices
use SixBySix\Freeagent\OAuth\Api;
use SixBySix\Freeagent\Entity\EntityCollection;
use SixBySix\Freeagent\Entity\Invoice;
/** @var Api $api */
$api = new Api(
$clientId = getenv('API_CLIENT_ID'),
$clientSecret = getenv('API_CLIENT_SECRET'),
$refreshToken = getenv('API_REFRESH_TOKEN'),
$sandbox = true
);
/** @var EntityCollection $invoiceCollection */
$invoiceCollection = $api->invoice()->query([
'view' => 'last_3_months',
]);
/** @var Invoice $invoice */
foreach ($invoiceCollection as $invoice) {
echo "{$invoice->getReference()}\n";
}
Bug Reports
Please use the Github Issue Tracker for support., (*9)