Currently seeking new career opportunities in web development, particularly with Laravel, Hire Me
Laravel Xero


A Laravel package for working with Xero.

Box API documentation can be found at:


A routes example:

Route::group(['middleware' => ['web', 'auth']], function(){
    Route::get('xero', function(){

        if (! Xero::isConnected()) {
            return redirect('xero/connect');
        } else {
            //display your tenant name
            return Xero::getTenantName();


    Route::get('xero/connect', function(){
        return Xero::connect();

Or using a middleware route, if the user does not have a token then automatically redirect to get authenticated:

Route::group(['middleware' => ['web', 'XeroAuthenticated']], function(){
    Route::get('xero', function(){
        return Xero::getTenantName();

Route::get('xero/connect', function(){
    return Xero::connect();

Once authenticated you can call Xero:: with the following verbs:

Xero::get($endpoint, $array = [])
Xero::post($endpoint, $array = [])
Xero::put($endpoint, $array = [])
Xero::patch($endpoint, $array = [])
Xero::delete($endpoint, $array = [])

The second param of array is not always required, its requirement is determined from the endpoint being called, see the API documentation for more details.

These expect the API endpoints to be passed, the URL is provided, only endpoints after this should be used ie:

Laravel Modules Your Logo Your Logo Your Logo

Become a sponsor

Help support the blog so that I can continue creating new content!


My Latest Book

Modular Laravel Book - Laravel: The Modular way

Learn how to build modular applications with Laravel Find out more

Subscribe to my newsletter

Subscribe and get my books and product announcements.

Learn Laravel with Laracasts

Faster Laravel Hosting

© 2006 - 2024 DC Blog. All code MIT license. All rights reserved.