Download the PHP package macsidigital/laravel-xero without Composer
On this page you can find all versions of the php package macsidigital/laravel-xero. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download macsidigital/laravel-xero
More information about macsidigital/laravel-xero
Files in macsidigital/laravel-xero
Package laravel-xero
Short Description Xero Laravel package
License MIT
Homepage https://github.com/macsidigital/laravel-xero
Informations about the package laravel-xero
Laravel package for Xero Accounting
A little Laravel package to communicate with Xero.
Installation
You can install the package via composer:
The service provider should automatically register for For Laravel > 5.4.
For Laravel < 5.5, open config/app.php and, within the providers array, append:
Configuration file
Publish the configuration file
This will create a xero/config.php within your config directory. Check the Xero documentation for the relevant values in the config.php file. Ensure that the location of the RSA keys matches.
Usage
Everything has been setup to be similar to Laravel syntax.
We also use a little bit of magic to work with Xero's model names. In Xero there are a few different modules (Accounting, Payroll AU etc.), at the minute we only support a small part of the accounting area, but we have set naming so that additional modules can be added in future.
If the response is anything other than a '200' then we will throw an exception, so use try catch blocks.
So to use the conacts in the Accounting module we would use the following syntax.
Find all
The find all function returns a Laravel Collection so you can use all the Laravel Collection magic
Filtered
The filtered find function returns a Laravel Collection so you can use all the Laravel Collection magic
To only get a single item use the 'first' method
You can also just passs the name and value if it is to equal
Find by ID
Just like Laravel we can use the 'find' method to return a single matched result on the ID
Creating Items
We can create and update records using the save function, below is the full save script for a creation. Please note the functions for adding multi array items, like addresses.
Example
Here is an example usage case for querying for a contact, creating if not found and then creating an invoice
Resources
At present we have the following resources
- Account
- Contacts
- Invoices
- Payments
- PrePayments
- OverPayments
- CreditNotes
We plan to add more resources in the future but setting up additional models is straight forward, below is the invoice model setup. If you create any models, then create a pull request and we will add into main repo.
Testing
At present there is no PHP Unit Testing, but we plan to add it in the future.
Changelog
Please see CHANGELOG for more information what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
Credits
- Colin Hall
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-xero with dependencies
guzzlehttp/guzzle Version ~6.0|~5.0|~4.0
guzzlehttp/oauth-subscriber Version 0.3.*
illuminate/support Version ^6.0|^7.0