tonijz / xero-laravel
Xero Service Provider for Laravel 4
Installs: 12
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 9
pkg:composer/tonijz/xero-laravel
Requires
- php: >=5.3.0
- illuminate/support: 4.1.x
This package is not auto-updated.
Last update: 2024-10-08 07:18:19 UTC
README
A simple Laravel 4 service provider for including the PHP Xero API.
Installation
The Xero Service Provider can be installed via Composer by requiring the Softlabs/xero-laravel package and setting the minimum-stability to dev in your project's composer.json.
{
"require": {
"laravel/framework": "4.0.*",
"Softlabs/xero-laravel": "1.*"
},
"minimum-stability": "dev"
}
Also you need to add the repository to composer.json:
"repositories": [ { "type": "vcs", "url": "https://github.com/Softlabs/xero-laravel" } ]
Usage
To use the Xero Service Provider, you must register the provider when bootstrapping your Laravel application.
Use Laravel Configuration
Create a new app/config/xero.php configuration file with the following options:
return array( 'key' => '<your-xero-key>', 'secret' => '<your-xero-secret>', 'publicPath' => '../app/config/xero/publickey.cer', 'privatePath' => '../app/config/xero/privatekey.pem' );
Find the providers key in app/config/app.php and register the Xero Service Provider.
'providers' => array( // ... 'Softlabs\XeroLaravel\XeroLaravelServiceProvider', )
Find the aliases key in app/config/app.php and add in our Xero alias.
'aliases' => array( // ... 'XeroLaravel' => 'Softlabs\XeroLaravel\Facades\XeroLaravel', )
Setting up the application
Create public and private keys, and save them in /app/config/xero/ as publickey.cer and privatekey.pem.
For more info on setting up your keys, check out the Xero documentation
Example Usage
$contact = array(
array(
"Name" => $user['company']['name'],
"FirstName" => $user['firstname'],
"LastName" => $user['surname'],
)
);
$xero_contact = XeroLaravel::Contacts($contact);