nexdev/invoice-creator
Composer 安装命令:
composer require nexdev/invoice-creator
包简介
Laravel invoice creator
README 文档
README
A Laravel package for creating and managing invoices in your Laravel application.
Installation
1. Install the package with Composer
Run the following command in your Laravel project:
composer require nexdev/invoice-creator
2. Setup the package
Run the following artisan command to install the package:
php artisan invoice:install
During the installation, you'll be prompted with two questions:
-
Install views? (yes/no) [no]
- This will publish the Invoice template, allowing you to customize the appearance of your invoices.
-
Install config? (yes/no) [no]
- This will publish the configuration file.
3. Configure Storage (Optional)
If you want to store the invoices in storage, add the following storage disks to your config/filesystems.php file:
'disks' => [ // ... other disks ... 'incoming_invoices' => [ 'driver' => 'local', 'root' => storage_path('app/incoming_invoices'), 'url' => env('APP_URL').'/storage/incoming_invoices', 'visibility' => 'public', 'throw' => false, 'report' => false, ], 'outgoing_invoices' => [ 'driver' => 'local', 'root' => storage_path('app/outgoing_invoices'), 'url' => env('APP_URL').'/storage/outgoing_invoices', 'visibility' => 'public', 'throw' => false, 'report' => false, ], ],
Note: The disk names should match those in the
invoices.phpconfig file. You can configure the drivers as needed, but maintain the same names.
Usage
Creating an Invoice
The package provides a fluent interface for creating invoices. Here's an example of how to create an outgoing invoice:
use NexDev\InvoiceCreator\Models\Seller; use NexDev\InvoiceCreator\Models\Buyer; use NexDev\InvoiceCreator\Models\OutgoingInvoice; // Create the seller information $seller = Seller::make() ->setName('Acme Corporation') ->setEmail('contact@acme.com') ->setPhone('+1 (555) 123-4567') ->setAddress('123 Business Street') ->setZip('10001') ->setCity('New York') ->setCountry('United States') ->setKvk('12345678') ->setVat('US12345678901'); // Create the buyer information $buyer = Buyer::make() ->setName('Tech Solutions Ltd') ->setAddress('456 Innovation Drive') ->setZip('EC2A 4PB') ->setCity('London') ->setCountry('United Kingdom'); // Create and process the invoice return OutgoingInvoice::make() ->setLogo('images/logo.png') ->setSeller($seller) ->setBuyer($buyer) ->setId('INV-2025-001') ->saveToDatabase() ->saveToStorage() ->stream();
Available Methods
Seller
fields:
setName(string $name)setAddress(string $address)setZip(string $zip)setCity(string $city)setCountry(string $country)setEmail(string $email)setPhone(string $phone)setKvk(string $kvk)setVat(string $vat)
Buyer
fields:
setName(string $name)setAddress(string $address)setZip(string $zip)setCity(string $city)setCountry(string $country)setEmail(string $email)setPhone(string $phone)setKvk(string $kvk)setVat(string $vat)
Invoice
setLogo(string $path)setSeller(Seller $seller)setBuyer(Buyer $buyer)setId(string $id)saveToDatabase()saveToStorage()stream()
Features
- Fluent Interface: Easy-to-use method chaining for creating invoices
- Database Storage: Save invoice data to the database
- File Storage: Save generated invoices to storage
- Streaming: Stream the generated invoice directly to the browser
- Customizable: Modify the invoice template to match your brand
nexdev/invoice-creator 适用场景与选型建议
nexdev/invoice-creator 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 319 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 03 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 nexdev/invoice-creator 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 nexdev/invoice-creator 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 319
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-03-24