Laravel Developer
David Carr
Web Developer
All Posts Archives Categories Authors
About Books Packages Templates Contact
Blog
All Posts Archives Categories Authors
About Books Packages Templates Contact
Laravel Xero
Laravel Packages
Laravel Microsoft Graph Laravel Xero Laravel Sent Emails Laravel Dropbox Laravel Box Laravel Companies House Laravel Countries Laravel Eventbrite Laravel Blade Components
PHP Packages
PDO Wrapper PHP find and replace JSON SQL Import IMAP Export CSV Pagination
v1
Navigation
  • Introduction
  • Install
  • Commands
  • Middleware
  • Is Connected
  • Disconnect
  • Tenant
  • Helpers
  • DTOs
  • Enums
  • Contacts
  • Credit Notes
  • Invoices
  • Webhooks
Navigation
  • Introduction
  • Install
  • Commands
  • Middleware
  • Is Connected
  • Disconnect
  • Tenant
  • Helpers
  • DTOs
  • Enums
  • Contacts
  • Credit Notes
  • Invoices
  • Webhooks

Introduction

This documentation provides a comprehensive guide to using the Laravel Xero package, which allows you to integrate your Laravel application with the Xero accounting system.

Xero API documentation can be found at: https://developer.xero.com/documentation/

Usage

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

//Authenticated
Route::middleware('XeroAuthenticated')->group(function(){
    Route::get('xero', function() {
        return Xero::getTenantName();
    });
});

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

Direct Requests

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

// GET request
Xero::get($endpoint = '', $data = [], $sendRawRequest = false, $accept = 'application/json', $headers = []);

// POST request
Xero::post($endpoint= '', $data = [], $sendRawRequest = false, $accept = 'application/json', $headers = []);

// PUT request
Xero::put($endpoint= '', $data = [], $sendRawRequest = false, $accept = 'application/json', $headers = []);

// PATCH request
Xero::patch($endpoint= '', $data = [], $sendRawRequest = false, $accept = 'application/json', $headers = []);

// DELETE request
Xero::delete($endpoint= '', $data = [], $sendRawRequest = false, $accept = 'application/json', $headers = []);

Parameters

$endpoint = string '/contacts'

$data = array ['key' => 'value']

$sendRawRequest = bool false (when true send a body payload otherwise send JSON)

$accept = string 'application/json'

$headers = array ['key' => 'value']

These expect the API endpoints to be passed, the URL https://api.xero.com/api.xro/2.0/ is provided, only endpoints after this should be used:

Xero::get('contacts');
Table of Contents
  • Usage
  • Direct Requests
  • Parameters

DCBlog

Practical tutorials, code snippets, and in-depth guides for modern web development. Helping developers build better applications since 2009.

Subscribe to my newsletter for the latest updates on my books and digital products.

© 2009 - 2025 DC Blog. All rights reserved.

Privacy Policy • Terms of Service