PHPackages                             adman9000/laravel-xero - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. adman9000/laravel-xero

ActiveLibrary

adman9000/laravel-xero
======================

A Laravel 5 wrapper for Xero's PHP API forked from drawmyattention/xerolaravel

v2.2(5y ago)07PHP

Since Jun 16Pushed 5y agoCompare

[ Source](https://github.com/adman9000/laravel-xero)[ Packagist](https://packagist.org/packages/adman9000/laravel-xero)[ RSS](/packages/adman9000-laravel-xero/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (1)Versions (17)Used By (0)

[![Packagist](https://camo.githubusercontent.com/85e922b893aa3ad6fb56602b641e5c2e307cee39dec6f905df588a15170cca3d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f61646d616e393030302f7865726f6c61726176656c2e737667)](https://packagist.org/packages/adman9000/xerolaravel)

Xero Accounting API Laravel 5 Wrapper
=====================================

[](#xero-accounting-api-laravel-5-wrapper)

A Laravel 5 wrapper for calcinai/xero-php (a custom API for integrating with Xero).

Installation via Composer
-------------------------

[](#installation-via-composer)

**Require the package**

```
composer require adman9000/laravel-xero

```

**Add the Service Provider to your `config/app.php` under `providers`**

```
'adman9000\LaravelXero\Providers\XeroServiceProvider',

```

\*\*Register the Facades within `config/app.php` under `aliases`

```
'XeroPrivate'=> 'adman9000\LaravelXero\Facades\XeroPrivate',

```

**Publish the configuration file**

```
php artisan vendor:publish

```

This will create a `xero/config.php` within your `config` directory. (Note: Ensure that you have generated the necessary tokens and have generated the RSA keys required by Xero for authentication.) Edit the relevant values in the `config.php` file.

Ensure that the location of the RSA keys matches the required format `(file://absolutepath)`

Dependencies and Requirements
-----------------------------

[](#dependencies-and-requirements)

This Service Provider current wraps the [calcinai/xero-php](https://github.com/calcinai/xero-php) version 1.1.\* package.

Additionally, you must have PHP installed with the following extensions:

- php\_curl (7.30+)
- php\_openssl

Usage
-----

[](#usage)

There are two ways to use the classes: via the IoC container, or via a Facade. They both offer the same functionality, so use each depending on your preference.

### Get all invoices

[](#get-all-invoices)

Facade

```
$invoices = XeroPrivate::load('Accounting\\Invoice')->execute();

```

IoC Container

```
// Create an instance of the class, resolved out of the IoC container
$xero = $this->app->make('XeroPrivate');

$invoices = $xero->load('Accounting\\Invoice')->execute();

```

### Get a single invoice via GUID or invoice number

[](#get-a-single-invoice-via-guid-or-invoice-number)

Facade

```
$invoice = XeroPrivate::loadByGUID('Accounting\\Invoice', 'inv-0004);

```

IoC Container

```
$xero = $this->app->make('XeroPrivate');

$invoice = $xero->loadByGUID('Accounting\\Invoice', 'inv-0004);

```

### Update an existing invoice

[](#update-an-existing-invoice)

Facade

```
$invoice = XeroPrivate::loadByGUID('Accounting\\Invoice', 'inv-0004);

$invoice->setStatus('Paid');

XeroPrivate::save($invoice);

```

IoC Container

```
$xero = $this->app->make('XeroPrivate');

$invoice = $xero->loadByGUID('Accounting\\Invoice', 'inv-0004);

$invoice->setStatus('Paid');

$xero->save($invoice);

```

### Creating a new invoice

[](#creating-a-new-invoice)

```
/*
 * Resolve instances of Xero, XeroInvoice, XeroContact
 * and XeroInvoiceLine out of the IoC container.
 */

$xero = $this->app->make('XeroPrivate');
$invoice = $this->app->make('XeroInvoice');
$contact = $this->app->make('XeroContact');
$line1 = $this->app->make('XeroInvoiceLine');
$line2 = $this->app->make('XeroInvoiceLine');

// Set up the invoice contact
$contact->setAccountNumber('DMA01');
$contact->setContactStatus('ACTIVE');
$contact->setName('Amo Chohan');
$contact->setFirstName('Amo');
$contact->setLastName('Chohan');
$contact->setEmailAddress('amo.chohan@gmail.com');
$contact->setDefaultCurrency('GBP');

// Assign the contact to the invoice
$invoice->setContact($contact);

// Set the type of invoice being created (ACCREC / ACCPAY)
$invoice->setType('ACCREC');

$dateInstance = new DateTime();
$invoice->setDate($dateInstance);
$invoice->setDueDate($dateInstance);
$invoice->setInvoiceNumber('DMA-00001');
$invoice->setReference('DMA-00001');

// Provide an URL which can be linked to from Xero to view the full order
$invoice->setUrl('http://yourdomain/fullpathtotheorder');

$invoice->setCurrencyCode('GBP');
$invoice->setStatus('Draft');

// Create some order lines
$line1->setDescription('Blue tshirt');

$line1->setQuantity(1);
$line1->setUnitAmount(99.99);
$line1->setTaxAmount(0);
$line1->setLineAmount(99.99);
$line1->setDiscountRate(0); // Percentage

// Add the line to the order
$invoice->addLineItem($line1);

// Repeat for all lines...

$xero->save($invoice);

```

### Creating Attachments

[](#creating-attachments)

```
$xero = $this->app->make('XeroPrivate');

$attachment = $this->app->make('XeroAttachment')
    ->createFromLocalFile(storage_path('your_file.pdf'));

$invoice = $xero->loadByGUID('Accounting\\Invoice', 'AMO-00002');
$invoice->addAttachment($attachment);

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 78.3% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~141 days

Recently: every ~282 days

Total

15

Last Release

1997d ago

Major Versions

v1.2.1 → v2.12020-11-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae880dbbda6b1c137ae16c67517d3fa06cce8de817116b7fc3747d590ede7482?d=identicon)[adman9000](/maintainers/adman9000)

---

Top Contributors

[![amochohan](https://avatars.githubusercontent.com/u/2978619?v=4)](https://github.com/amochohan "amochohan (47 commits)")[![adman9000](https://avatars.githubusercontent.com/u/4179099?v=4)](https://github.com/adman9000 "adman9000 (5 commits)")[![tariqbilal](https://avatars.githubusercontent.com/u/12066559?v=4)](https://github.com/tariqbilal "tariqbilal (2 commits)")[![elliotlings](https://avatars.githubusercontent.com/u/1894100?v=4)](https://github.com/elliotlings "elliotlings (2 commits)")[![ziming](https://avatars.githubusercontent.com/u/679513?v=4)](https://github.com/ziming "ziming (1 commits)")[![BozenaWloch](https://avatars.githubusercontent.com/u/33554645?v=4)](https://github.com/BozenaWloch "BozenaWloch (1 commits)")[![gerrywastaken](https://avatars.githubusercontent.com/u/71481?v=4)](https://github.com/gerrywastaken "gerrywastaken (1 commits)")[![tuscan88](https://avatars.githubusercontent.com/u/7439796?v=4)](https://github.com/tuscan88 "tuscan88 (1 commits)")

### Embed Badge

![Health badge](/badges/adman9000-laravel-xero/health.svg)

```
[![Health](https://phpackages.com/badges/adman9000-laravel-xero/health.svg)](https://phpackages.com/packages/adman9000-laravel-xero)
```

###  Alternatives

[langleyfoxall/xero-laravel

💸 Access the Xero accounting system using an Eloquent-like syntax

86235.1k](/packages/langleyfoxall-xero-laravel)[drawmyattention/xerolaravel

A Laravel 5 wrapper for Xero's PHP API

43175.9k](/packages/drawmyattention-xerolaravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
