dystcz / laravel-fakturoid
Fakturoid Laravel 封装器
2.0.0
2024-05-02 00:11 UTC
Requires
- php: ^8.2
- fakturoid/fakturoid-php: ^1.0
- illuminate/support: ^11.0
- laravel/framework: ^11.0
Requires (Dev)
- orchestra/testbench: ^9.0
This package is auto-updated.
Last update: 2024-09-02 00:52:43 UTC
README
简单封装官方php包 https://github.com/fakturoid/fakturoid-php
文档
安装
步骤 1: 安装包
通过执行以下命令将包添加到您的 composer.json 中。
composer require dystcz/laravel-fakturoid
这将同时更新 composer.json 并将包安装到 vendor/ 目录下。
步骤 2: 配置
首先,通过运行以下命令初始化配置文件
php artisan vendor:publish
使用此命令初始化配置并修改位于 config/fakturoid.php
下的创建的文件。
配置
return [ 'account_name' => env('FAKTUROID_NAME', 'XXX'), 'account_email' => env('FAKTUROID_EMAIL', 'XXX'), 'account_api_key' => env('FAKTUROID_API_KEY', 'XXX'), 'app_contact' => env('FAKTUROID_APP_CONTACT', 'Application <your@email.cz>'), ];
示例
创建主题,创建发票,发送发票
use Fakturoid; try { // create subject $subject = Fakturoid::createSubject(array( 'name' => 'Firma s.r.o.', 'email' => 'aloha@pokus.cz' )); if ($subject->getBody()) { $subject = $subject->getBody(); // create invoice with lines $lines = [ [ 'name' => 'Big sale', 'quantity' => 1, 'unit_price' => 1000 ], ]; $invoice = Fakturoid::createInvoice(array('subject_id' => $subject->id, 'lines' => $lines)); $invoice = $invoice->getBody(); // send created invoice Fakturoid::fireInvoice($invoice->id, 'deliver'); } } catch (\Exception $e) { dd($e->getCode() . ": " . $e->getMessage()); }
许可协议
版权所有 © 2019 - 2024 dyst digital s.r.o MIT 许可。