A Laravel wrapper for Xero
- PHP >= 7.2
- php_curl extension - ensure a recent version (7.30+)
- php_openssl extension
This package wraps calcinai/xero-php package.
Require the package
composer require pulkitjalan/xero-laravel
Laravel 5.5 uses Package Auto-Discovery, so you don't need to manually add the ServiceProvider.
If you don't use auto-discovery, add the following to the providers
array in your config/app.php
PulkitJalan\Xero\XeroServiceProvider::class,
Next add the following to the aliases
array in your config/app.php
. Pick and choose if you want or add all 3.
'XeroPrivate' => PulkitJalan\Xero\Facades\XeroPrivate::class,
'XeroPublic' => PulkitJalan\Xero\Facades\XeroPublic::class,
'XeroPartner' => PulkitJalan\Xero\Facades\XeroPartner::class,
Next run php artisan vendor:publish --provider="PulkitJalan\Xero\XeroServiceProvider"
to publish the config file.
Since this package wraps calcinai/xero-php, have a look at the readme there for further details.
Example:
use XeroPHP\Application\PrivateApplication
class App {
protected $xero;
public function __construct(PrivateApplication $xero) {
$this->xero = $xero;
}
}
or
use XeroPHP\Application\PrivateApplication
$xero = app(PrivateApplication::class);
// or
$xero = app('XeroPrivate');
or use the facades.