latheesan-k/laravel-xero 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

latheesan-k/laravel-xero

Composer 安装命令:

composer require latheesan-k/laravel-xero

包简介

Xero Service Provider for Laravel 4

README 文档

README

Originally forked from https://github.com/VentureCraft/xero-laravel and updated to support newer API features (e.g. ContactGroups and paging results etc...).

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

Installation

The Xero Service Provider can be installed via Composer by requiring the latheesan-k/laravel-xero package and setting the minimum-stability to dev in your project's composer.json.

{
	"require": {
		"laravel/framework": "4.0.*",
		"latheesan-k/laravel-xero": "dev-master"
	},
	"minimum-stability": "dev"
}

Usage

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

Use Laravel Configuration

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

return array(
    'key'           => '<your-xero-key>',
    'secret'        => '<your-xero-secret>',
    'publicPath'    => app_path() .'/config/xero/publickey.cer',
    'privatePath'   => app_path() .'/config/xero/privatekey.pem'
);

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

    'providers' => array(
        // ...
        'Latheesan\LaravelXero\LaravelXeroServiceProvider',
    )

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

    'aliases' => array(
        // ...
        'LaravelXero' 	  => 'Latheesan\LaravelXero\Facades\LaravelXero',
    )

Setting up the application

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

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

Example Usage

Create a Contact in Xero

$contact = array(
    array(
       	"Name"        => 'Company Name Ltd',
       	"FirstName"   => 'John',
		"LastName"    => 'Doe',
	)
);

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

GET Contacts with WHERE clause & Paging

$where = "ContactNumber!=null&IsCustomer=true";
$page  = 1;

print_r(LaravelXero::Contacts(false, false, $where, false, $page));

Reference

统计信息

  • 总下载量: 14
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 2
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2014-12-03