Download the PHP package cakephp-biztech/cakephp-xero-oauth2 without Composer
On this page you can find all versions of the php package cakephp-biztech/cakephp-xero-oauth2. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cakephp-biztech/cakephp-xero-oauth2
More information about cakephp-biztech/cakephp-xero-oauth2
Files in cakephp-biztech/cakephp-xero-oauth2
Package cakephp-xero-oauth2
Short Description Xero Oauth2 API plugin for CakePHP 3.x
License MIT
Homepage https://github.com/cakephp-biztech/cakephp-xero-oauth2
Informations about the package cakephp-xero-oauth2
Xero OAuth2 API plugin for CakePHP 3.x
This plugin provides access to Xero OAuth2 API for CakePHP. This plugin is wrapper around Xero PHP official SDK.
Requirements
- CakePHP 3.5 or greater
- PHP 5.6 or greater
Installation
-
You can install this plugin into your CakePHP application using composer
-
After installation, load the plugin
Or, you can load the plugin using the shell command:
- Run plugin migration to create table
Setup
Now create new file to set your Xero App details.
-
Create new file
xero_config.php
inconfig
directory:Note: Do not forget to replace "https://example.com" with your website URL in your
config/xero_config.php
file. - After creating the configuration file, make sure to load the file in your
bootstrap.php
:
Important:
When you create your Xero API App you must have to specify 'OAuth 2.0 redirect URI' to https://your-website.com/xero-oauth2/callback (replace "https://your-website.com" with your website URL).
Usage
This plugin ships with XeroOauth
component which can be used to get the instance of:
\XeroAPI\XeroPHP\Api\AccountingApi
viaaccountingApi()
method\XeroAPI\XeroPHP\Api\AssetApi
viaassetApi()
method\XeroAPI\XeroPHP\Api\IdentityApi
viaidentityApi()
method\XeroAPI\XeroPHP\Api\ProjectApi
viaprojectApi()
method
Load XeroOauth
component:
Once you have an instance of \XeroAPI\XeroPHP\Api\AccountingApi::class
you're dealing directly with Xero's official SDK.
The Accounting API requires we pass through a tenant ID on each request. You can get value of that using Storage
component. Also, you can get additional token details from this component as well.
Following examples shows how to get contacts from Accounting API:
src/Controller/ContactsController.php
You can also check XeroAPI Oauth2 App repository's example file.
Reference
- Official Xero PHP SDK: https://github.com/XeroAPI/xero-php-oauth2
- Example: https://github.com/XeroAPI/xero-php-oauth2-app/blob/master/example.php
Issues
Feel free to submit issues and enhancement requests.