Download the PHP package derrickleemy/laravel-xero-oauth2 without Composer
On this page you can find all versions of the php package derrickleemy/laravel-xero-oauth2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download derrickleemy/laravel-xero-oauth2
More information about derrickleemy/laravel-xero-oauth2
Files in derrickleemy/laravel-xero-oauth2
Package laravel-xero-oauth2
Short Description A Laravel integration for Xero using the Oauth 2.0 spec
License MIT
Homepage https://github.com/webfox/laravel-xero-oauth2
Informations about the package laravel-xero-oauth2
A Laravel integration for Xero using the Oauth 2.0 spec
This package integrates the new reccomended package of xeroapi/xero-php-oauth2 using the Oauth 2.0 spec with Laravel.
Installation
You can install this package via composer using the following command:
The package will automatically register itself.
You can publish the configuration file with:
You'll want to set the scopes required for your application in the config file.
You should add your Xero keys to your .env file using the following keys:
When setting up the application in Xero ensure your redirect url is https://{your-domain}/xero/auth/callback
Using the Package
This package registers two bindings into the service container you'll be interested in:
\XeroAPI\XeroPHP\Api\AccountingApi::class
this is the main api for Xero - see the xeroapi/xero-php-oauth2 docs for usage. When you first resolve this dependency if the stored credentials are expired it will automatically refresh the token.Webfox\Xero\OauthCredentialManager
this is the credential manager - The Accounting API requires we pass through a tenant ID on each request, this class is how you'd access that. This is also where we can get information about the authenticating user. See below for an example.
app\Http\Controllers\XeroController.php
resources\views\xero.blade.php
routes/web.php
Using Webhooks
On your application in the Xero developer portal create a webhook to get your webhook key.
You can then add this to your .env file as
You can then setup a controller to handle your webhook and inject \Webfox\Xero\Webhook
e.g.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-xero-oauth2 with dependencies
xeroapi/xero-php-oauth2 Version ^1.0
laravel/framework Version ^5.5|^6.0|^7.0