babaweb / laravel-zohoinvoice
此包已被弃用且不再维护。未建议替代包。
Zoho Invoice API 库
v0.9
2018-07-26 11:59 UTC
Requires
- php: ^5.3 | ^7.0
- guzzlehttp/guzzle: ~6.0
Requires (Dev)
- phpspec/phpspec: ~2.0
- phpunit/phpunit: 4.*
README
Laravel 的 Zoho Invoice API 实现
要求
要运行,所有元素都是必需的
安装
运行 Composer require 命令
composer require babaweb/laravel-zohoinvoice
修改 config/app.php
文件以添加 provider
'providers' => [
...
Babaweb\ZohoInvoice\ZohoInvoiceServiceProvider::class
],
最后发布文件
php artisan vendor:publish --provider="Babaweb\ZohoInvoice\ZohoInvoiceServiceProvider"
然后 tadaaa!包已准备好。
配置
要连接到 ZohoInvoice API,需要 tokens。要在 config/zohoinvoice.php
文件中填写它们,需要打开文件
return [
'authtoken' => env('ZOHO_AUTHTOKEN', 'VOTRE_AUTH_TOKEN'),
'organization_id' => env('ZOHO_ORGANIZATION', 'VOTRE_ORGANIZATION_ID')
];
使用
添加 facade
use Babaweb\ZohoInvoice\ZohoInvoice;
例如,使用 test
函数
public function test(ZohoInvoice $client) {
//Vos requêtes ici
}
函数
可用函数列表
- getContacts() : 返回联系人列表
- getInvoices($customer_id) : 根据客户 ID 返回发票列表
- getInvoice($invoice_id) : 返回具有指定 ID 的发票
- getInvoicePayments($invoice_id) : 返回具有指定 ID 的发票的付款列表
- createItem($parameters) : 从参数创建项
- createInvoice($parameters) : 从参数创建发票
- createContact($parameters) : 从参数创建联系人
- updateItem($item_id, $parameters) : 从参数修改项
函数详细信息
createItem($parameters)
$parameters = [
//required
'name' => 'Product 6.1', //Nom de l'item
'rate' => '300', //Prix unitaire de l'item
//Optional
'description' => 'Test product', //Description de l'item
'tax_id' => 39448000000026222, //ID de la taxe
'product_type' => 'service', //Type de l'item
];
createInvoice($parameters)
$parameters = [
//required
'customer_id' => 982000000567001, //ID du client
//Optional
'invoice_number' => 'INV-00003', //Numéro de la facture
'discount' => 0, //Réduction appliquée à la facture. Soit en pourcentage (12.5%) ou un montant (190)
'is_discount_before_tax' => true, //Vrai si la réduction s'applique au HT
];
createContact($parameters)
$parameters = [
//required
'contact_name' => 'Bowman and Co', //Nom du contact
//Optional
'company_name' => 'Bowman and Co', //Nom de la société
];
updateItem($item_id, $parameters)
$parameters = [
//required
'name' => 'Product 6.1', //Nom de l'item
'rate' => '300', //Prix unitaire de l'item
//Optional
'description' => 'Test product', //Description de l'item
'tax_id' => 39448000000026222, //ID de la taxe
'product_type' => 'service', //Type de l'item
];
许可
此 Laravel 的 ZohoInvoice 包是 MIT 许可的自由软件