PHPackages                             m1ke/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. m1ke/xero

ActiveLibrary

m1ke/xero
=========

A fork of the old Xero OAuth private application API

12.3k1PHP

Since Jun 17Pushed 11y ago1 watchersCompare

[ Source](https://github.com/M1ke/PHP-Xero)[ Packagist](https://packagist.org/packages/m1ke/xero)[ RSS](/packages/m1ke-xero/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

PHP-Xero PHP Wrapper
====================

[](#php-xero-php-wrapper)

This is a fork of an earlier version of the [Xero](http://xero.com) PHP library, mainly forked because the team are no longer maintaining it (see below). I have also added it to [Packagist](https://packagist.org/packages/m1ke/xero) which means it can be installed with [Composer](https://getcomposer.org).

### No longer maintained

[](#no-longer-maintained)

Please note the PHP-Xero wrapper library is no longer under active development. All development effort is going into the [XeroOAuth-PHP library](https://github.com/XeroAPI/XeroOAuth-PHP).

Introduction
------------

[](#introduction)

A class for interacting with the xero (xero.com) private application API. It could also be used for the public application API too, but it hasn't been tested with that. More documentation for Xero can be found at  It is suggested you become familiar with the API before using this class, otherwise it may not make much sense to you -

Thanks for the Oauth\* classes provided by Andy Smith, find more about them at . The OAuthSignatureMethod\_Xero class was written by me, as required by the Oauth classes. The ArrayToXML classes were sourced from wwwzealdcom's work as shown on the comment dated August 30, 2009 on this page:  I made a few minor changes to that code to overcome some bugs.

### Requires

[](#requires)

PHP5+

### Authors

[](#authors)

Ronan Quirke, Xero (just very minor bugfixes, vast majority of work done by David Pitman)

Composer package by M1ke

Installation
------------

[](#installation)

```
composer.phar require m1ke/xero

```

Usage
-----

[](#usage)

Basically instantiate the Xero class with your credentials and desired output format. Then call any of the methods as outlined in the API. Calling an API method name as a property is the same as calling that API method with no options. Calling the API method as a method with an array as the only input param with like calling the corresponding POST or PUT API method. You can make more complex GET requests using up to four params on the method. If you have read the xero api documentation, it should be clear.

### GET Request usage

[](#get-request-usage)

Retrieving a result set from Xero involves identifying the endpoint you want to access, and optionally, setting some parameters to further filter the result set. There are 5 possible parameters:

1. Record filter: The first parameter could be a boolean "false" or a unique resource identifier: document ID or unique number eg: $xero-&gt;Invoices('INV-2011', false, false, false, false);
2. Modified since: second parameter could be a date/time filter to only return data modified since a certain date/time eg: $xero-&gt;Invoices(false, "2012-05-11T00:00:00");
3. Custom filters: an array of filters, with array keys being filter fields (left of operand), and array values being the right of operand values. The array value can be a string or an array(operand, value), or a boolean eg: $xero-&gt;Invoices(false, false, $filterArray);
4. Order by: set the ordering of the result set eg: $xero-&gt;Invoices('', '', '', 'Date', '');
5. Accept type: this only needs to be set if you want to retrieve a PDF version of a document, eg: $xero-&gt;Invoices($invoice\_id, '', '', '', 'pdf');

Further details on filtering GET requests here:

### Example Usage:

[](#example-usage)

```
