- How do I install and set up laravel-invoices in a Laravel project?
- Run `composer require laraveldaily/laravel-invoices:^4.1.1` to install, then execute `php artisan invoices:install` to publish assets, views, translations, and the config file. This sets up the package with default templates and configurations in your project.
- Does laravel-invoices support Laravel 12? What about older versions?
- The package officially supports Laravel 11 and 12. For older versions, check the [previous versions documentation](PREVIOUS.md) or use a compatible release (e.g., v3.x for Laravel 9/10). Always verify compatibility before upgrading.
- Can I customize the invoice PDF templates without touching the core package?
- Yes, the package uses Blade templates. Publish the default templates with `php artisan vendor:publish --tag=invoices.views`, then modify the files in `resources/views/vendor/invoices/`. Use unique namespaces (e.g., `myapp::invoices/default`) to avoid conflicts during updates.
- How do I handle multi-currency invoices or dynamic currency formatting?
- Configure global currency settings in `config/invoices.php` (e.g., `default_currency`, `symbol_position`). Override per-invoice with `->setCurrency('EUR')` or dynamically format amounts using the `formatCurrency()` helper provided by the package.
- Is it possible to generate invoices in bulk or via a queue for performance?
- Yes, PDF generation is I/O-bound, so queue invoice creation using Laravel Queues. For bulk operations, loop through items and dispatch jobs (e.g., `GenerateInvoiceJob`) to avoid timeouts. Cache templates to further optimize performance.
- How do I store invoices? Can I use a database or only filesystems?
- Invoices are stored as PDF files on any configured Laravel filesystem (e.g., S3, local disk). The package doesn’t use a database by default, but you can manually track metadata (e.g., status, dates) in your own tables if needed.
- Does laravel-invoices support taxes, discounts, and shipping costs?
- Yes, the package supports fixed or percentage-based taxes (per item or invoice), discounts (fixed or percentage), and shipping costs. Configure these in the `config/invoices.php` or override them dynamically when building an invoice (e.g., `->addTax(10)`).
- Can I integrate laravel-invoices with an existing ERP or CRM system?
- The package provides a simple API to generate invoices from your data (e.g., orders, subscriptions). Map your data to `Buyer`, `InvoiceItem`, etc., and use the `Invoice::make()` builder. For ERP/CRM integrations, extend the `Party` or `InvoiceItem` classes or use the `setCustomData()` method to pass additional fields.
- How do I send invoices via email or provide download links?
- Use the `->download()` or `->stream()` methods to generate the PDF in-memory. For emails, attach the PDF using Laravel’s `Mail` facade or stream it directly. Store the PDF path (e.g., `storage/app/invoices/invoice-123.pdf`) and generate download links via `Storage::url()`.
- What are the licensing implications of using laravel-invoices (GPL-3.0)?
- The package is licensed under GPL-3.0, which requires open-sourcing your project if you modify or distribute it. If your project uses a proprietary license, consult your legal team or consider alternatives like `barryvdh/laravel-dompdf` (MIT-licensed) for PDF generation.