PHP Wrapper for Xero API
, (*1)
Requirements
- PHP 7+
- guzzlehttp/guzzle
- guzzlehttp/oauth-subscriber
Introduction
This application was written as a simple Xero API wrapper for use in a laravel application. At this stage, support is only available for private applications., (*2)
Installation
Recommended installation is through Composer., (*3)
console:, (*4)
composer require servality/xero:dev-master
or add to composer.json:, (*5)
{
"require": {
"servality/xero": "dev-master"
}
}
Prerequisites
A Xero organisation is required to use the API. It's recommended a demo company is created for testing. Follow the steps at Xero Developer to create a private application., (*6)
Usage
Basic usage
$config = [
'oauth' => [
'consumer_key' => 'appication_consumer_key',
'consumer_secret' => 'appication_consumer_secret',
'private_key_file' => 'path/to/private_key.pem',
'private_key_passphrase' => 'passphrase'
],
'response' => 'json', //json or xml
'user_agent' => 'application_name'
]
$xero = new XeroApplication($config);
$xero->invoices()->get();
Filtering
$xero->contacts()->where('name.contains("Mark")')->get();
Xml Helper
This package included and XML Helper class for converting an array to xml., (*7)
See wiki Page for details., (*8)
License
Open-sourced software licensed under the MIT license., (*9)