Xero API wrapper

dev-master 2019-03-25 10:00 UTC

This package is auto-updated.

Last update: 2024-05-04 14:04:24 UTC


README

Latest Stable Version License

Requirements

  • PHP 7+
  • guzzlehttp/guzzle
  • guzzlehttp/oauth-subscriber

Introduction

This application was written as a simple Xero API wrapper for use in a laravel application. At this stage, support is only available for private applications.

Installation

Recommended installation is through Composer.

console:

composer require servality/xero:dev-master

or add to composer.json:

  {
    "require": {
    "servality/xero": "dev-master"
    }
  }

Prerequisites

A Xero organisation is required to use the API. It's recommended a demo company is created for testing. Follow the steps at Xero Developer to create a private application.

Usage

Basic usage

   $config = [
       'oauth' => [
           'consumer_key' => 'appication_consumer_key',
           'consumer_secret' => 'appication_consumer_secret',
           'private_key_file' => 'path/to/private_key.pem',
           'private_key_passphrase' => 'passphrase'
       ],
       'response' => 'json', //json or xml
       'user_agent' => 'application_name'
   ]
   
   $xero = new XeroApplication($config);
   
   $xero->invoices()->get();

Filtering

   $xero->contacts()->where('name.contains("Mark")')->get();

Xml Helper

This package included and XML Helper class for converting an array to xml.

See wiki Page for details.

License

Open-sourced software licensed under the MIT license.