### Run Laravel Invoices Installation Command Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md After installing the package, run this Artisan command to publish its assets, views, translations, and configuration files. ```bash php artisan invoices:install ``` -------------------------------- ### Full Advanced Invoice Generation Example Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt This comprehensive example demonstrates combining multiple features for advanced invoice generation, including seller/customer details, multiple items with discounts, custom formatting, and saving the invoice to disk. Ensure all necessary classes are imported. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Party; use LaravelDaily\Invoices\Classes\InvoiceItem; $seller = new Party([ 'name' => 'Roosevelt Lloyd', 'phone' => '(520) 318-9486', 'custom_fields' => ['business id' => '365#GG'], ]); $customer = new Party([ 'name' => 'Ashley Medina', 'address' => 'The Green Street 12', 'code' => '#22663214', 'custom_fields' => ['order number' => '> 654321 <'], ]); $items = [ InvoiceItem::make('Service 1')->description('Development work')->pricePerUnit(47.79)->quantity(2)->discount(10), InvoiceItem::make('Service 2')->pricePerUnit(71.96)->quantity(2), InvoiceItem::make('Service 3')->pricePerUnit(4.56), InvoiceItem::make('Service 4')->pricePerUnit(87.51)->quantity(7)->discount(4)->units('kg'), InvoiceItem::make('Service 5')->pricePerUnit(71.09)->quantity(7)->discountByPercent(9), ]; $invoice = Invoice::make('receipt') ->series('BIG') ->status(__('invoices::invoice.paid')) ->sequence(667) ->serialNumberFormat('{SEQUENCE}/{SERIES}') // → 00667/BIG ->seller($seller) ->buyer($customer) ->date(now()->subWeeks(3)) ->dateFormat('m/d/Y') ->payUntilDays(14) ->currencySymbol('$') ->currencyCode('USD') ->currencyFormat('{SYMBOL}{VALUE}') ->currencyThousandsSeparator('.') ->currencyDecimalPoint(',') ->filename($seller->name . ' ' . $customer->name) ->addItems($items) ->notes('Payment due within 14 days. Late fees apply.') ->logo(public_path('vendor/invoices/sample-logo.png')) ->save('public'); // Save to public disk $link = $invoice->url(); // Share via email return $invoice->stream(); // Also display in browser ``` -------------------------------- ### Generate and Stream an Invoice Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md This example demonstrates how to create a new invoice, set a buyer, add items, apply discounts, taxes, and shipping, then stream the generated PDF. Ensure the necessary classes are imported. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; // ... $customer = new Buyer([ 'name' => 'John Doe', 'custom_fields' => [ 'email' => 'test@example.com', ], ]); $item = InvoiceItem::make('Service 1')->pricePerUnit(2); $invoice = Invoice::make() ->buyer($customer) ->discountByPercent(10) ->taxRate(15) ->shipping(1.99) ->addItem($item); return $invoice->stream(); ``` -------------------------------- ### Install laravel-invoices for Laravel <= 8 Source: https://github.com/laraveldaily/laravel-invoices/blob/master/PREVIOUS.md Use this composer command to install version 2.0 of the package for Laravel versions 8 and below. ```bash $ composer require laraveldaily/laravel-invoices:^2.0 ``` -------------------------------- ### Create and Stream an Invoice Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Example demonstrating how to create a new Invoice instance using `Invoice::make()`, add a buyer and an item, and then stream the generated PDF to the browser. Requires `Buyer` and `InvoiceItem` classes. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'John Doe', 'custom_fields' => ['email' => 'john@example.com']]); $item = InvoiceItem::make('Web Development')->pricePerUnit(500.00)->quantity(3); $invoice = Invoice::make('invoice') ->buyer($buyer) ->addItem($item); return $invoice->stream(); ``` -------------------------------- ### Install laravel-invoices for Laravel <= 7 Source: https://github.com/laraveldaily/laravel-invoices/blob/master/PREVIOUS.md Use this composer command to install version 1.3 of the package for Laravel versions 7 and below. ```bash $ composer require laraveldaily/laravel-invoices:^1.3 ``` -------------------------------- ### Install laravel-invoices for Laravel <= 9 Source: https://github.com/laraveldaily/laravel-invoices/blob/master/PREVIOUS.md Use this composer command to install version 3.3 of the package for Laravel versions 9 and below. ```bash $ composer require laraveldaily/laravel-invoices:^3.3 ``` -------------------------------- ### Install and Update Laravel Invoices Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Commands to install the package and publish/update its assets and translations. Use `invoices:update` to refresh templates and translations after upgrading. ```bash composer require laraveldaily/laravel-invoices:^4.1.1 php artisan invoices:install # To update templates/translations after a package upgrade: php artisan invoices:update # Or selectively: php artisan vendor:publish --tag=invoices.views --force php artisan vendor:publish --tag=invoices.translations --force ``` -------------------------------- ### Configure Laravel Invoices Defaults Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Example configuration file (`config/invoices.php`) showing global defaults for dates, serial numbers, currency, paper size, storage disk, and the default seller. These can be overridden per-invoice. ```php // config/invoices.php return [ 'date' => [ 'format' => 'Y-m-d', 'pay_until_days' => 7, ], 'serial_number' => [ 'series' => 'AA', 'sequence' => 1, 'sequence_padding' => 5, 'delimiter' => '.', 'format' => '{SERIES}{DELIMITER}{SEQUENCE}', ], 'currency' => [ 'code' => 'eur', 'fraction' => 'ct.', 'symbol' => '€', 'decimals' => 2, 'decimal_point' => '.', 'thousands_separator' => '', 'format' => '{VALUE} {SYMBOL}', ], 'paper' => [ 'size' => 'a4', 'orientation' => 'portrait', ], 'disk' => 'local', 'seller' => [ 'class' => \LaravelDaily\Invoices\Classes\Seller::class, 'attributes' => [ 'name' => 'Towne, Smith and Ebert', 'address' => '89982 Pfeffer Falls Damianstad, CO 66972-8160', 'code' => '41-1985581', 'vat' => '123456789', 'phone' => '760-355-3930', 'custom_fields' => [ 'SWIFT' => 'BANK101', ], ], ], 'dompdf_options' => [ 'enable_php' => true, 'logOutputFile' => '', ], ]; ``` -------------------------------- ### Run Tests with Composer Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Execute the test suite for the laravel-invoices package using Composer. Ensure you have Composer installed and the package dependencies are set up. ```bash $ composer test ``` -------------------------------- ### Install Laravel Invoices via Composer Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Use this command to add the latest version of the Laravel Invoices package to your project. ```bash composer require laraveldaily/laravel-invoices:^4.1.1 ``` -------------------------------- ### Create Parties and Items Using Facade Helpers Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Demonstrates using the `Invoice` facade to create `Party` (seller/customer) and `InvoiceItem` instances without explicit imports. The invoice is then built and streamed. ```php use Invoice; // Facade alias registered by the package $seller = Invoice::makeParty(['name' => 'Acme Corp', 'address' => '123 Main St', 'vat' => 'DE123456789']); $customer = Invoice::makeParty(['name' => 'Jane Smith', 'address' => '456 Oak Ave', 'code' => 'CUST-001']); $item = Invoice::makeItem('Annual SaaS License')->pricePerUnit(1200.00); return Invoice::make() ->seller($seller) ->buyer($customer) ->addItem($item) ->stream(); ``` -------------------------------- ### Generate Detailed Invoice with Custom Parties and Items Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Use this snippet to create a comprehensive invoice with detailed client and customer information, a list of items with descriptions, prices, quantities, and discounts. It also shows how to set currency, date formats, and save the invoice. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Party; use LaravelDaily\Invoices\Classes\InvoiceItem; // ... $client = new Party([ 'name' => 'Roosevelt Lloyd', 'phone' => '(520) 318-9486', 'custom_fields' => [ 'note' => 'IDDQD', 'business id' => '365#GG', ], ]); $customer = new Party([ 'name' => 'Ashley Medina', 'address' => 'The Green Street 12', 'code' => '#22663214', 'custom_fields' => [ 'order number' => '> 654321 <', ], ]); $items = [ InvoiceItem::make('Service 1') ->description('Your product or service description') ->pricePerUnit(47.79) ->quantity(2) ->discount(10), InvoiceItem::make('Service 2')->pricePerUnit(71.96)->quantity(2), InvoiceItem::make('Service 3')->pricePerUnit(4.56), InvoiceItem::make('Service 4')->pricePerUnit(87.51)->quantity(7)->discount(4)->units('kg'), InvoiceItem::make('Service 5')->pricePerUnit(71.09)->quantity(7)->discountByPercent(9), InvoiceItem::make('Service 6')->pricePerUnit(76.32)->quantity(9), InvoiceItem::make('Service 7')->pricePerUnit(58.18)->quantity(3)->discount(3), InvoiceItem::make('Service 8')->pricePerUnit(42.99)->quantity(4)->discountByPercent(3), InvoiceItem::make('Service 9')->pricePerUnit(33.24)->quantity(6)->units('m2'), InvoiceItem::make('Service 11')->pricePerUnit(97.45)->quantity(2), InvoiceItem::make('Service 12')->pricePerUnit(92.82), InvoiceItem::make('Service 13')->pricePerUnit(12.98), InvoiceItem::make('Service 14')->pricePerUnit(160)->units('hours'), InvoiceItem::make('Service 15')->pricePerUnit(62.21)->discountByPercent(5), InvoiceItem::make('Service 16')->pricePerUnit(2.80), InvoiceItem::make('Service 17')->pricePerUnit(56.21), InvoiceItem::make('Service 18')->pricePerUnit(66.81)->discountByPercent(8), InvoiceItem::make('Service 19')->pricePerUnit(76.37), InvoiceItem::make('Service 20')->pricePerUnit(55.80), ]; $notes = [ 'your multiline', 'additional notes', 'in regards of delivery or something else', ]; $notes = implode("
", $notes); $invoice = Invoice::make('receipt') ->series('BIG') // ability to include translated invoice status // in case it was paid ->status(__('invoices::invoice.paid')) ->sequence(667) ->serialNumberFormat('{SEQUENCE}/{SERIES}') ->seller($client) ->buyer($customer) ->date(now()->subWeeks(3)) ->dateFormat('m/d/Y') ->payUntilDays(14) ->currencySymbol('$') ->currencyCode('USD') ->currencyFormat('{SYMBOL}{VALUE}') ->currencyThousandsSeparator('.') ->currencyDecimalPoint(',') ->filename($client->name . ' ' . $customer->name) ->addItems($items) ->notes($notes) ->logo(public_path('vendor/invoices/sample-logo.png')) // You can additionally save generated invoice to configured disk ->save('public'); $link = $invoice->url(); // Then send email to party with link // And return invoice itself to browser or have a different view return $invoice->stream(); ``` -------------------------------- ### Create Party and Item using Facade Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md This snippet demonstrates an alternative way to create party and item objects using the Invoice facade, which can simplify syntax for common use cases. ```php 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(); ``` -------------------------------- ### Create Party and Buyer Objects Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Instantiate generic Party objects or extend them with Buyer. Both accept custom fields for additional information. ```php use LaravelDaily\Invoices\Classes\Party; use LaravelDaily\Invoices\Classes\Buyer; // Generic Party (can be used for both seller and buyer) $seller = new Party([ 'name' => 'Roosevelt Lloyd', 'phone' => '(520) 318-9486', 'custom_fields' => [ 'note' => 'IDDQD', 'business id' => '365#GG', ], ]); // Buyer (extends Party — identical API) $buyer = new Buyer([ 'name' => 'Ashley Medina', 'address' => 'The Green Street 12', 'code' => '#22663214', 'custom_fields' => [ 'order number' => '> 654321 <', ], ]); ``` -------------------------------- ### Build Invoice Line Items with InvoiceItem::make() Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Use the fluent builder for invoice line items, supporting prices, quantities, units, discounts, and taxes. Subtotals can be set manually. ```php use LaravelDaily\Invoices\Classes\InvoiceItem; $items = [ // Basic item InvoiceItem::make('Service 1')->pricePerUnit(47.79)->quantity(2), // With description and fixed discount InvoiceItem::make('Service 2') ->description('Custom software development') ->pricePerUnit(47.79) ->quantity(2) ->discount(10), // Fixed currency discount per item // With units and percentage discount InvoiceItem::make('Timber') ->pricePerUnit(87.51) ->quantity(7) ->units('kg') ->discountByPercent(4), // 4% discount // With item-level tax InvoiceItem::make('Consulting') ->pricePerUnit(200.00) ->quantity(1) ->taxByPercent(20), // 20% tax on this item only // Manually set subtotal (bypasses auto-calculation) InvoiceItem::make('Manual Entry') ->pricePerUnit(0) ->subTotalPrice(999.99), ]; ``` -------------------------------- ### Invoice File Methods Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Methods for generating, saving, and retrieving the invoice as a file. ```APIDOC ## Invoice File Methods ### stream Opens the invoice in the browser for viewing. ### download Offers the invoice file for download. ### save Saves the invoice to the specified storage disk. Use the `filename()` method to override the default filename. - **Parameters** - `disk` (string) - The storage disk to save the invoice to. ### url Returns the URL of the saved invoice. ### toHtml Renders the invoice as an HTML view instead of a PDF. ``` -------------------------------- ### Register Invoice Facade Source: https://github.com/laraveldaily/laravel-invoices/blob/master/PREVIOUS.md To use the Invoice facade for generating invoices, add its alias to the facades array in config/app.php. ```php 'Invoice' => LaravelDaily\Invoices\Facades\Invoice::class ``` -------------------------------- ### Publish Laravel Invoices Views Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Manually publish the package's view files using this Artisan command. The --force flag will overwrite existing views. ```bash php artisan vendor:publish --tag=invoices.views --force ``` -------------------------------- ### Invoice Currency Methods Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Methods for configuring and formatting currency details for the invoice. ```APIDOC ## Invoice Currency Methods ### currencyCode Sets the currency code (e.g., 'EUR', 'USD'). - **Parameters** - `code` (string) - The currency code. ### currencyFraction Sets the name of the currency fraction (e.g., 'Cents', 'Centimes'). - **Parameters** - `fraction` (string) - The currency fraction name. ### currencySymbol Sets the currency symbol (e.g., '€', '$'). - **Parameters** - `symbol` (string) - The currency symbol. ### currencyDecimals Sets the number of decimal places for the currency. - **Parameters** - `decimals` (int) - The number of decimal places. ### currencyDecimalPoint Sets the character used for the decimal point. - **Parameters** - `point` (string) - The decimal point character. ### currencyThousandsSeparator Sets the character used for the thousands separator. - **Parameters** - `separator` (string) - The thousands separator character. ### currencyFormat Sets the overall format for displaying currency values. - **Parameters** - `format` (string) - The currency format string (e.g., '{VALUE} {SYMBOL}'). ### getAmountInWords Spells out a given float amount into words, with optional locale. - **Parameters** - `amount` (float) - The amount to spell out. - `locale` (string, optional) - The locale for spelling out the amount. ### getTotalAmountInWords Spells out the total amount of the invoice into words. ### formatCurrency Formats a float amount according to the invoice's currency settings. - **Parameters** - `amount` (float) - The amount to format. ``` -------------------------------- ### Add Notes, Status, and Custom Data to Invoice Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Use this snippet to attach free-text notes (HTML allowed), a payment status label, and custom key-value data to an invoice. Ensure the necessary classes are imported. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'Client']); $item = InvoiceItem::make('Service')->pricePerUnit(100); $notes = implode('
', [ 'Payment via bank transfer only.', 'Reference: ORDER-20250120', 'Thank you for your business!', ]); $invoice = Invoice::make() ->buyer($buyer) ->addItem($item) ->status(__('invoices::invoice.paid')) // Translated status label ->notes($notes) // HTML allowed ->setCustomData(['project_id' => 42, 'po_number' => 'PO-9981']); // In template: $invoice->notes, $invoice->status // Retrieve in controller: $invoice->getCustomData()['project_id'] ``` -------------------------------- ### Output Invoice as PDF or HTML Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Deliver the generated PDF invoice via streaming, download, or saving to a file. The `stream()` method displays inline, `download()` forces a file download, and `save()` writes to disk. `toHtml()` renders a debuggable HTML version. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'Jane Smith']); $item = InvoiceItem::make('Annual Plan')->pricePerUnit(299.00); $invoice = Invoice::make() ->buyer($buyer) ->addItem($item) ->filename('invoice_jane_smith_2025'); // Override auto-generated filename // Stream inline in browser (Content-Disposition: inline) return $invoice->stream(); // Force download (Content-Disposition: attachment) return $invoice->download(); // Save to a filesystem disk and get the URL (e.g. to email a link) $invoice->save('public'); $link = $invoice->url(); // https://your-app.com/storage/invoice_jane_smith_2025.pdf // Save to default disk from config $invoice->save(); // Render as HTML (useful for template debugging) return $invoice->toHtml(); ``` -------------------------------- ### Update Laravel Invoices Templates Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Run this Artisan command to update the package's default views and templates to the latest version. It will prompt for confirmation before overriding existing files. ```bash php artisan invoices:update ``` -------------------------------- ### Apply Invoice-Level Taxes and Discounts Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Set a single tax rate or discount for the entire invoice. Mixing item-level and invoice-level taxes/discounts will cause an exception. Supports percentage or fixed amounts. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'John Doe']); $item = InvoiceItem::make('Service')->pricePerUnit(100.00)->quantity(5); // Percentage-based discount + tax rate + shipping on the invoice $invoice = Invoice::make() ->buyer($buyer) ->addItem($item) ->discountByPercent(10) // 10% off invoice total ->taxRate(15) // 15% tax on discounted total ->shipping(9.99); // Fixed shipping added after tax // Or fixed amounts: // ->totalDiscount(25.00) // ->totalTaxes(18.50) // ->taxableAmount(400.00) // Override the base used for tax calculation // ->totalAmount(600.00) // Bypass all calculation, set final total directly return $invoice->stream(); ``` -------------------------------- ### Set Invoice Date, Format, and Due Date Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Configure the invoice date, specify its display format, and set the number of days until payment is due. The `dateFormat` method uses standard PHP date formatting. `payUntilDays` calculates the due date relative to the invoice date. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'Client B']); $item = InvoiceItem::make('Service')->pricePerUnit(200); $invoice = Invoice::make() ->buyer($buyer) ->addItem($item) ->date(now()->subWeeks(3)) // Backdated invoice ->dateFormat('m/d/Y') // US date format ->payUntilDays(14); // Due 14 days after invoice date echo $invoice->getDate(); // "01/15/2025" echo $invoice->getPayUntilDate(); // "01/29/2025" ``` -------------------------------- ### Customize Currency Formatting Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Control how currency values are displayed, including symbol, ISO code, decimal places, and separators. The `formatCurrency` method applies these settings, while `getAmountInWords` spells out the amount using locale-specific formatting. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'US Client']); $item = InvoiceItem::make('Consulting')->pricePerUnit(1999.50)->quantity(2); $invoice = Invoice::make() ->buyer($buyer) ->addItem($item) ->currencySymbol('$') ->currencyCode('USD') ->currencyFraction('cents') ->currencyDecimals(2) ->currencyDecimalPoint('.') ->currencyThousandsSeparator(',') ->currencyFormat('{SYMBOL}{VALUE}'); // → $3,999.00 // After render/calculate: $invoice->calculate(); echo $invoice->formatCurrency(1999.50); // "$1,999.50" echo $invoice->getAmountInWords(1999.50); // "One thousand nine hundred ninety-nine USD and fifty cents" echo $invoice->getAmountInWords(1999.50, 'de'); // German locale spelling echo $invoice->getTotalAmountInWords(); // Spells out $invoice->total_amount ``` -------------------------------- ### Invoice General Methods Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Methods for general invoice manipulation, including adding items, setting status, seller, buyer, and custom data. ```APIDOC ## Invoice General Methods ### addItem Adds a single invoice item. - **Parameters** - `item` (InvoiceItem) - The item to add. ### addItems Adds multiple invoice items. - **Parameters** - `items` (Iterable) - An iterable collection of items to add. ### name Sets the name of the invoice. - **Parameters** - `name` (string) - The name for the invoice. ### status Sets the status of the invoice (e.g., 'paid', 'due'). - **Parameters** - `status` (string) - The invoice status. ### seller Sets the seller party for the invoice. - **Parameters** - `seller` (PartyContract) - The seller object. ### buyer Sets the buyer party for the invoice. - **Parameters** - `buyer` (PartyContract) - The buyer object. ### setCustomData Attaches additional custom data to the invoice. - **Parameters** - `data` (mixed) - The data to attach. ### getCustomData Retrieves the custom data attached to the invoice. ### template Sets the template to be used for the invoice. - **Parameters** - `template` (string) - The path or name of the template. ### logo Sets the path to the invoice logo. - **Parameters** - `path` (string) - The file path to the logo. ### getLogo Returns the base64 encoded image of the logo, used in templates. ### filename Overrides the automatically generated filename for the invoice. - **Parameters** - `filename` (string) - The desired filename. ### taxRate Sets the tax rate for the invoice. - **Parameters** - `rate` (float) - The tax rate. ### shipping Sets the shipping amount for the invoice. - **Parameters** - `amount` (float) - The shipping amount. ### totalDiscount Sets the total discount for the invoice. If not provided, it calculates itself. - **Parameters** - `discount` (float) - The total discount amount. ### totalTaxes Sets the total taxes for the invoice. If not provided, it calculates itself. - **Parameters** - `taxes` (float) - The total taxes amount. ### totalAmount Sets the total amount for the invoice. If not provided, it calculates itself. - **Parameters** - `amount` (float) - The total amount. ### taxableAmount Sets the taxable amount for the invoice. If not provided, it calculates itself. - **Parameters** - `amount` (float) - The taxable amount. ``` -------------------------------- ### Publish Laravel Invoices Translations Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Manually publish the package's translation files using this Artisan command. The --force flag will overwrite existing translation files. ```bash php artisan vendor:publish --tag=invoices.translations --force ``` -------------------------------- ### Invoice Date Methods Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Methods for managing the invoice date and payment due date. ```APIDOC ## Invoice Date Methods ### date Sets the invoice date. - **Parameters** - `date` (CarbonInterface) - The invoice date. ### dateFormat Sets the date format using Carbon's format. - **Parameters** - `format` (string) - The Carbon date format string. ### payUntilDays Sets the number of days until payment is due, relative to the invoice date. - **Parameters** - `days` (int) - The number of days. ### getDate Returns the formatted invoice date. ### getPayUntilDate Returns the formatted payment due date. ``` -------------------------------- ### Select and Use Custom Invoice Templates Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Specify a custom Blade template for rendering invoices by placing it in `resources/views/vendor/invoices/templates/`. The `template()` method selects the template by name. Available invoice object properties are accessible within the template. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'Corporate Client']); $item = InvoiceItem::make('License')->pricePerUnit(500); // Use a custom template at: // resources/views/vendor/invoices/templates/my_company.blade.php $invoice = Invoice::make('receipt') ->buyer($buyer) ->addItem($item) ->template('my_company'); // Inside any template, the full Invoice object is available as $invoice: // $invoice->seller, $invoice->buyer, $invoice->items (Collection) // $invoice->getSerialNumber(), $invoice->getDate(), $invoice->getPayUntilDate() // $invoice->formatCurrency($amount), $invoice->getTotalAmountInWords() // $invoice->getLogo() — returns base64-encoded data URI for the logo image // $invoice->total_amount, $invoice->total_taxes, $invoice->total_discount // $invoice->shipping_amount, $invoice->taxable_amount // $invoice->hasItemUnits, $invoice->hasItemDiscount, $invoice->hasItemTax // $invoice->table_columns — dynamically adjusted colspan count ``` -------------------------------- ### Configure Invoice Settings Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md This is the main configuration file for the Laravel Invoices package. It allows customization of date formats, serial numbers, currency display, paper size, and seller information. ```php return [ 'date' => [ /** * Carbon date format */ 'format' => 'Y-m-d', /** * Due date for payment since invoice's date. */ 'pay_until_days' => 7, ], 'serial_number' => [ 'series' => 'AA', 'sequence' => 1, /** * Sequence will be padded accordingly, for ex. 00001 */ 'sequence_padding' => 5, 'delimiter' => '.', /** * Supported tags {SERIES}, {DELIMITER}, {SEQUENCE} * Example: AA.00001 */ 'format' => '{SERIES}{DELIMITER}{SEQUENCE}', ], 'currency' => [ 'code' => 'eur', /** * Usually cents * Used when spelling out the amount and if your currency has decimals. * * Example: Amount in words: Eight hundred fifty thousand sixty-eight EUR and fifteen ct. */ 'fraction' => 'ct.', 'symbol' => '€', /** * Example: 19.00 */ 'decimals' => 2, /** * Example: 1.99 */ 'decimal_point' => '.', /** * By default empty. * Example: 1,999.00 */ 'thousands_separator' => '', /** * Supported tags {VALUE}, {SYMBOL}, {CODE} * Example: 1.99 € */ 'format' => '{VALUE} {SYMBOL}', ], 'paper' => [ // A4 = 210 mm x 297 mm = 595 pt x 842 pt 'size' => 'a4', 'orientation' => 'portrait', ], 'disk' => 'local', 'seller' => [ /** * Class used in templates via $invoice->seller * * Must implement LaravelDaily * or extend LaravelDaily */ 'class' => \LaravelDaily\Invoices\Classes\Seller::class, /** * Default attributes for Seller::class */ 'attributes' => [ 'name' => 'Towne, Smith and Ebert', 'address' => '89982 Pfeffer Falls Damianstad, CO 66972-8160', 'code' => '41-1985581', 'vat' => '123456789', 'phone' => '760-355-3930', 'custom_fields' => [ /** * Custom attributes for Seller::class * * Used to display additional info on Seller section in invoice * attribute => value */ 'SWIFT' => 'BANK101', ], ], ], ]; ``` -------------------------------- ### Specify Invoice Template Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Use the `template` method to specify a custom Blade template for rendering invoices. Ensure your custom template is located in the correct directory. ```php Invoice::make('receipt')->template('my_company'); ``` -------------------------------- ### Invoice Serial Number Methods Source: https://github.com/laraveldaily/laravel-invoices/blob/master/README.md Methods for configuring and retrieving the invoice's serial number. ```APIDOC ## Invoice Serial Number Methods ### series Sets the series part of the serial number. - **Parameters** - `series` (string) - The series identifier. ### sequence Sets the sequence number. - **Parameters** - `sequence` (int) - The sequence number. ### delimiter Sets the delimiter for the serial number. - **Parameters** - `delimiter` (string) - The delimiter character. ### sequencePadding Sets the padding for the sequence number. - **Parameters** - `padding` (int) - The number of digits for padding. ### serialNumberFormat Sets the format for the serial number. - **Parameters** - `format` (string) - The format string (e.g., '{SERIES}{DELIMITER}{SEQUENCE}'). ### getSerialNumber Returns the formatted serial number. ``` -------------------------------- ### Add Line Items to Invoice Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Attach single or multiple InvoiceItem objects to an Invoice using addItem() or addItems(). ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'Client Corp']); $items = [ InvoiceItem::make('Design Work')->pricePerUnit(150)->quantity(8), InvoiceItem::make('Hosting')->pricePerUnit(29.99)->quantity(12), ]; $invoice = Invoice::make() ->buyer($buyer) ->addItems($items) // Iterable ->addItem(InvoiceItem::make('Domain')->pricePerUnit(15)); // Single item return $invoice->download(); ``` -------------------------------- ### Embed Logo in Invoices Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Include a logo image in the invoice by providing its absolute path to the `logo()` method. The `getLogo()` method in templates returns a base64 data URI, ensuring proper rendering across different environments. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'Client']); $item = InvoiceItem::make('Service')->pricePerUnit(100); $invoice = Invoice::make() ->buyer($buyer) ->addItem($item) ->logo(public_path('vendor/invoices/sample-logo.png')); // Absolute path // In a Blade template: // Logo ``` -------------------------------- ### Register Invoice Service Provider Source: https://github.com/laraveldaily/laravel-invoices/blob/master/PREVIOUS.md If auto-discovery is not used, manually add the InvoiceServiceProvider to the providers array in config/app.php for Laravel versions prior to 5.5. ```php LaravelDaily\Invoices\InvoiceServiceProvider::class, ``` -------------------------------- ### Configure Invoice Serial Number Formatting Source: https://context7.com/laraveldaily/laravel-invoices/llms.txt Customize invoice numbering with series labels, sequence numbers, padding, delimiters, and format templates. Supports {SERIES}, {DELIMITER}, and {SEQUENCE} tags. ```php use LaravelDaily\Invoices\Invoice; use LaravelDaily\Invoices\Classes\Buyer; use LaravelDaily\Invoices\Classes\InvoiceItem; $buyer = new Buyer(['name' => 'Client A']); $item = InvoiceItem::make('Product')->pricePerUnit(50); $invoice = Invoice::make() ->buyer($buyer) ->addItem($item) ->series('INV') // Series prefix ->sequence(1042) // Sequence number (auto-padded) ->sequencePadding(6) // → 001042 ->delimiter('-') ->serialNumberFormat('{SERIES}{DELIMITER}{SEQUENCE}'); // → INV-001042 echo $invoice->getSerialNumber(); // "INV-001042" // Custom format: sequence before series $invoice2 = Invoice::make() ->buyer($buyer) ->addItem($item) ->series('BIG') ->sequence(667) ->serialNumberFormat('{SEQUENCE}/{SERIES}'); // → 00667/BIG ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.