XeroBundle
makes it easy to communicate with the Xero api using the Guzzle library
-
Add the following to your
composer.json
file"require": { ... "blackoptic/xerobundle": "*" ... }
-
Run
php composer.phar update "blackoptic/xerobundle"
-
Register the bundle in your
app/AppKernel.php
:<?php ... public function registerBundles() { $bundles = array( ... new BlackOptic\Bundle\XeroBundle\BlackOpticXeroBundle(), ... ); ...
-
Add the config for your account details:
black_optic_xero: consumer_key: <Your Consumer Key> consumer_secret: <Your Consumer Secret> private_key: <Path to you private key>
-
Request and use the service:
$xeroClient = $this->get('blackoptic.xero.client'); $response = $xeroClient->get('Invoices')->send();