PHPackages                             byrontudhope/xerolaravel - 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. [API Development](/categories/api)
4. /
5. byrontudhope/xerolaravel

ActiveLibrary[API Development](/categories/api)

byrontudhope/xerolaravel
========================

A Laravel 5 wrapper for Xero's PHP API

v1.0.9(10y ago)04.0k1PHP

Since Jun 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/ByronTudhope/xerolaravel)[ Packagist](https://packagist.org/packages/byrontudhope/xerolaravel)[ RSS](/packages/byrontudhope-xerolaravel/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (1)Dependencies (1)Versions (12)Used By (0)

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 byrontudhope/xerolaravel "1.0.*"

```

**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)`

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

```
'ByronTudhope\XeroLaravel\Providers\XeroServiceProvider',

```

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

```
'XeroPrivate'=> 'ByronTudhope\XeroLaravel\Facades\XeroPrivate',

```

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

33

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 95.8% 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 ~36 days

Recently: every ~79 days

Total

10

Last Release

3658d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7d76d4befdae72c1cb85f0ff2a90b06354fc5f8013ec9b8400fa9d48d737bebd?d=identicon)[byrontudhope](/maintainers/byrontudhope)

---

Top Contributors

[![amochohan](https://avatars.githubusercontent.com/u/2978619?v=4)](https://github.com/amochohan "amochohan (23 commits)")[![gerrywastaken](https://avatars.githubusercontent.com/u/71481?v=4)](https://github.com/gerrywastaken "gerrywastaken (1 commits)")

### Embed Badge

![Health badge](/badges/byrontudhope-xerolaravel/health.svg)

```
[![Health](https://phpackages.com/badges/byrontudhope-xerolaravel/health.svg)](https://phpackages.com/packages/byrontudhope-xerolaravel)
```

###  Alternatives

[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M272](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/common-protos

Google API Common Protos for PHP

173103.7M50](/packages/google-common-protos)[hubspot/api-client

Hubspot API client

23414.2M16](/packages/hubspot-api-client)

PHPackages © 2026

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