Skip to content
This repository has been archived by the owner on Oct 23, 2019. It is now read-only.

Softlabs/xero-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Xero Service Provider for Laravel 5

A simple Laravel 5 service provider for including the PHP Xero API.

No longer maintained

Please note the PHP-Xero wrapper library used by this service provider is no longer under active development. All development effort is going into the XeroOAuth-PHP library.

We will review this after Laravel 5 has been released and likely leave this active (but unsupported) for anyone still using it for their Laravel 4 apps.

Installation

The Xero Service Provider can be installed via Composer by requiring the Softlabs/xero-laravel package in your project's composer.json.

{
    "require": {
        "Softlabs/xero-laravel": "3.*"
    },
}

Also you need to add the repository to composer.json:

"repositories": [
    {
        "type": "vcs",
        "url": "https://github.com/Softlabs/xero-laravel"
    }
]

Usage

To use the Xero Service Provider, you must register the provider when bootstrapping your Laravel application.

Use Laravel Configuration

Create a new config/xero.php configuration file with the following options:

return [
    'key'           => '<your-xero-key>',
    'secret'        => '<your-xero-secret>',
    'publicPath'    => '../config/xero/publickey.cer',
    'privatePath'   => '../config/xero/privatekey.pem',
    'format'        => 'json'
];

Find the providers key in config/app.php and register the Xero Service Provider.

    'providers' => [
        // ...
        'Softlabs\XeroLaravel\XeroLaravelServiceProvider',
    ]

Find the aliases key in config/app.php and add in our Xero alias.

    'aliases' => [
        // ...
        'XeroLaravel'     => 'Softlabs\XeroLaravel\Facades\XeroLaravel',
    ]

Setting up the application

Create public and private keys, and save them in /config/xero/ as publickey.cer and privatekey.pem.

For more info on setting up your keys, check out the Xero documentation

Example Usage

$contact = [
    [
        "Name"        => $user['company']['name'],
        "FirstName"   => $user['firstname'],
        "LastName"    => $user['surname'],
    ]
];

$xero_contact = XeroLaravel::Contacts($contact);

Reference

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages