eslam-abass/laravel-invoice-generator
Generate customizable PDF invoices in Laravel using publishable Blade templates. Supports dynamic line items, taxes/discounts, currency and localization, optional QR code links, config-driven branding, and easy preview/PDF output via facade.
A modern, clean Composer package for Laravel that generates customizable PDF invoices.
php artisan vendor:publish, and offers a facade or helper function like Invoice::make()->toPdf()You1. Require the package with Composer:
```bash
composer require your-vendor/laravel-invoice-generator
```
(Optional) Publish the configuration file and views:
php artisan vendor:publish --provider="YourVendor\\LaravelInvoiceGenerator\\InvoiceServiceProvider"
This will publish config/invoice.php and resources/views/vendor/invoice/template.blade.php.
use YourVendor\LaravelInvoiceGenerator\Facades\Invoice;
$data = [
'customer' => [
'name' => 'John Doe',
'address' => '123 Main St, Anytown, USA',
'email' => 'john.doe@example.com',
],
'items' => [
[
'description' => 'Product A',
'quantity' => 2,
'unit_price' => 10.00,
'total' => 20.00,
],
[
'description' => 'Service B',
'quantity' => 1,
'unit_price' => 50.00,
'total' => 50.00,
],
],
'subtotal' => 70.00,
'tax' => 7.00, // Assuming 10% tax
'discount' => 5.00,
'total' => 72.00,
'qr_code_link' => 'https://example.com/invoice/123',
];
return Invoice::make($data)->toPdf();
use YourVendor\LaravelInvoiceGenerator\Facades\Invoice;
$data = [
// ... same data as above
];
return Invoice::make($data)->preview();
The config/invoice.php file allows you to customize various settings:
template: The Blade template used for rendering the invoice.currency: Default currency for invoices.tax_rate: Default tax rate.company_logo, company_name, company_address, company_phone, company_email, company_website: Company branding details.qr_code: Settings for the optional QR code (enabled, size, color, background).pdf_generator: Currently only dompdf is supported.After publishing the views, you can edit resources/views/vendor/invoice/template.blade.php to fully customize the invoice's appearance.
The package leverages Laravel's localization features. Ensure your application's locale is set correctly, and the NumberFormatter in the Invoice class will handle currency formatting based on the current locale.
Feel free to contribute to this project by submitting issues or pull requests.
The Laravel Invoice Generator is open-sourced software licensed under the MIT license.
How can I help you explore Laravel packages today?