necenzurat / smartbill
兼容 Laravel 的 SmartBill API 封装
1.1.2
2024-08-06 11:18 UTC
Requires
- php: ^7.2.5|^8.0|^8.1|^8.2
- illuminate/support: ~5.8.0|^6.0|^7.0|^8.0|^9.0|^10.0|^11.0
Requires (Dev)
- orchestra/testbench: 3.8.*
- phpunit/phpunit: ^7.0|^8.1
README
Laravel 的简单 SmartBill API 集成
安装
第 1 步. 通过 Composer 安装包
composer require necenzurat/smartbill
第 2 步. 发布配置文件
php artisan vendor:publish --provider="Necenzurat\SmartBill\SmartBillServiceProvider" --tag="config"
第 3 步. 在 config/smartbill.php
文件中输入您的账户详细信息(API 用户名、密钥、增值税代码等)。
使用
点击查看使用方法
$invoice = [ 'companyVatCode' => config('smartbill.vatCode'), 'client' => [ 'name' => "Intelligent IT", 'vatCode' => "RO12345678", 'regCom' => "", 'address' => "str. Sperantei, nr. 5", 'isTaxPayer' => false, 'city' => "Sibiu", 'country' => "Romania", 'email' => "office@intelligent.ro", ], 'issueDate' => date('Y-m-d'), 'seriesName' => config('smartbill.invoiceSeries'), 'isDraft' => false, 'dueDate' => date('Y-m-d', time() + 3600 * 24 * 30), 'mentions' => '', 'observations' => '', 'deliveryDate' => date('Y-m-d', time() + 3600 * 24 * 10), 'precision' => 2, 'products' => [ [ 'name' => "Produs 1", 'code' => "ccd1", 'isDiscount' => false, 'measuringUnitName' => "buc", 'currency' => "RON", 'quantity' => 2, 'price' => 10, 'isTaxIncluded' => true, 'taxName' => "Redusa", 'taxPercentage' => 9, 'isService' => false, 'saveToDb' => false, ], ], ]; echo 'Emitere factura simpla: '; try { $smartbill = new SmartBill(); $output = $smartbill->createInvoice($invoice); //see docs for response $invoiceNumber = $output['number']; $invoiceSeries = $output['series']; echo $invoiceSeries . $invoiceNumber; } catch (\Exception $ex) { echo $ex->getMessage(); }
测试
hell no
变更日志
请参阅 变更日志 了解最近更改的详细信息。
贡献
请参阅 贡献指南 了解详细信息。
安全性
如果您发现任何安全相关的问题,请通过电子邮件 necenzurat@gmail.com 而不是使用问题跟踪器来报告。
致谢
许可证
WTFPL。请参阅 许可证文件 了解更多信息。