grim-reapper/xero
Composer 安装命令:
composer require grim-reapper/xero
包简介
XERO Auth2 integration
README 文档
README
#Xero OAuth2.0 API Integration
This package is just created to use in personal project, so all the function implemented according to our personal project. Please check this before use it.
// To use this package you have to extend it, create your own PHP class and extend this. class YourClassName extends \GrimReapper\Xero\Xero{ // then override it constructor public function __construct(array $params) { if(!empty($params)) { parent::__construct($params['client_id'], $params['client_secret'], $params['redirect_uri']); } } // that's it }
Create your class object first
$object = new YourClassName();
To get Authorize URL
$data = $object->getAuthorizeURL(); // it will return array containing URL and State Code $state = $data['state']; // this is used to verify state after api redirect to prevent xss $url = $data['url']; // use this url to redirect to Xero website for Authentication
To add scopes
$object->setScopes(['scope1','scope2']);
To get Access Token after redirection to your site
$code = $_GET['code']; // get code param from url and pass it to function $accessToken = $object->getAccessToken($code);
To create contact
$contact = $object->createContact(array $contactData);
To get a contact
$contact = $object->getContact(string $emailAddress);
To create an invoice
$invoice = $object->createInvoice(array $invoiceData);
To create a Payment
$payment = $object->createPayment($invoiceID, $account_code, $amount, $date);
To create a Credit Note
$creditNote = $object->createCreditNotes(array $creditNotesData, bool $returnObj = false);
To make Credit Note Payment
$creditNote = $object->createCreditNotePayment(array $paymentData);
统计信息
- 总下载量: 7
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-11-12