ercos / invoicing-sdk
v2.1.0
2024-06-13 08:22 UTC
Requires
- php: >=8.1
- guzzlehttp/guzzle: ^7.5
- nesbot/carbon: ^2.66
- phpoption/phpoption: ^1.9
- vlucas/phpdotenv: ^5.5
Requires (Dev)
- phpunit/phpunit: ^10
README
先决条件
- PHP 8.1
安装
composer require ercos/invoicing-sdk
配置
添加环境变量
INVOICING_BASE_URL
发票API的URL。例如https://:8000
INVOICING_APP_TOKEN
身份验证令牌
使用
为了与API通信,需要创建一个新的应用程序并获取身份验证令牌。
每个应用程序可以创建多个供应商,并为每个供应商创建发票和相关付款。
现有实体
- 供应商
- 发票
- 发票行集合
- 元数据集合
- 付款
使用示例
$invoice = Invoice::store(new StoreInvoiceDto(
vendor_id: 1,
date: '2020-10-10',
status: InvoiceStatus::Sent,
customer_name: 'Dev test',
invoice_lines: new InvoiceLineDtoCollection([
new InvoiceLineDto(
name: 'test item',
unit_price_tax_included: 100,
quantity: 1
)
]),
customer_email: 'test@test.com'
));
$invoice->send();