Laravel package to generate PDF invoices from various customizable parameters
Laravel package to generate PDF invoices from various customizable parameters
![![Banner]](https://banners.beyondco.de/Laravel%20Invoices.png?theme=light&packageManager=composer+require&packageName=laraveldaily%2Flaravel-invoices&pattern=architect&style=style_1&description=PDFs+made+easy&md=1&showWatermark=0&fontSize=100px&images=document-download)
This Laravel package provides an easy to use interface to generate Invoice PDF files with your provided data.
Invoice file can be stored, downloaded, streamed on any of the filesystems you have configured. Supports different templates and locales.
Via Composer
$ composer require laraveldaily/laravel-invoices:^4.1.1After installing Laravel Invoices, publish its assets, views, translations and config using the invoices:install Artisan command:
$ php artisan invoices:installSince it is evolving fast you might want to have latest template after update using Artisan command:
$ php artisan invoices:updateIt will give a warning if you really want to override default resources
Or alternatively it can be done separately.
$ php artisan vendor:publish --tag=invoices.views --force$ php artisan vendor:publish --tag=invoices.translations --forceRandomController.php
use LaravelDaily\Invoices\Invoice;
use LaravelDaily\Invoices\Classes\Buyer;
use LaravelDaily\Invoices\Classes\InvoiceItem;
// ...
$customer = new Buyer([
'name' => 'John Doe',
'custom_fields' => [
'email' => '[email protected]',
],
]);
$item = InvoiceItem::make('Service 1')->pricePerUnit(2);
$invoice = Invoice::make()
->buyer($customer)
->discountByPercent(10)
->taxRate(15)
->shipping(1.99)
->addItem($item);
return $invoice->stream();See result Invoice_AA_00001.pdf.
…See result Roosevelt Lloyd Ashley Medina.pdf.
Optionally you can use a facade to make new party or item
use Invoice;
$customer = Invoice::makeParty([
'name' => 'John Doe',
]);
$item = Invoice::makeItem('Your service or product title')->pricePerUnit(9.99);
return Invoice::make()->buyer($customer)->addItem($item)->stream();After publishing assets you can modify or make your own template for invoices.
Templates are stored in the resources/views/vendor/invoices/templates directory. There you will find default.blade.php template which is used by default.
You can specify which template to use by calling template method on Invoice object.
For example if you have resources/views/vendor/invoices/templates/my_company.blade.php it should look like this:
Invoice::make('receipt')->template('my_company');Too see how things work in a template you can view default.blade.php as an example.
…Almost every configuration value can be overrided dynamically by methods.
(new InvoiceItem())->title(string)$ composer testIf you discover any security related issues, please email [email protected] instead of using the issue tracker.
GPL-3.0-only. Please see the license file for more information.
No open issues yet, or sync has not completed.