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

Install

You can install the package via composer:

composer require dcblogdev/laravel-xero

Config

You can publish the config file with:

php artisan vendor:publish --provider="Dcblogdev\Xero\XeroServiceProvider" --tag="config"

Migration

You can publish the migration with:

php artisan vendor:publish --provider="Dcblogdev\Xero\XeroServiceProvider" --tag="migrations"

After the migration has been published, you can create the token tables by running the migration:

php artisan migrate

Configuration Options

Edit the config/xero.php file to set your Xero API credentials:

return [
    'clientId' => env('XERO_CLIENT_ID', ''),
    'clientSecret' => env('XERO_CLIENT_SECRET', ''),
    'redirectUri' => env('XERO_REDIRECT_URI', ''),
    'scopes' => env('XERO_SCOPES', 'openid email profile offline_access accounting.transactions accounting.contacts'),
    'landingUri' => env('XERO_LANDING_URI', '/'),
    'encrypt' => env('XERO_ENCRYPT', true),
];

.ENV Configuration

Ensure you've set the following in your .env file:

XERO_CLIENT_ID=
XERO_CLIENT_SECRET=
XERO_REDIRECT_URL=https://domain.com/xero/connect
XERO_LANDING_URL=https://domain.com/xero
XERO_WEBHOOK_KEY=
XERO_ENCRYPT=true

Application Register

Before you can integrate with Xero, you will need to create an app, go to https://developer.xero.com/myapps to register a new app.

For the grant type select, Auth code (web app)

For OAuth 2.0 redirect URI enter the full URL you want to use for connection to Xero from your application such as https://domain.com/xero/connect

Table of Contents
  • Config
  • Migration
    • Configuration Options
  • .ENV Configuration
  • Application Register

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