pixiucz / invoices
Empty
Installs: 166
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 1
Open Issues: 2
Language:HTML
Type:package
Requires
- barryvdh/laravel-dompdf: ^0.8.0
- twig/twig: *
This package is not auto-updated.
Last update: 2025-04-05 19:11:36 UTC
README
- Require package via composer
composer require pixiucz/invoices
- And then register
InvoicesServiceProvider
in yourconfig\app.php
(laravel) or in boot method of your October'sPlugin.php
Pixiucz\Invoices\InvoicesServiceProvider::class,
- Once installed, you are required to run migrations – either by running
php artisan migrate
or using provided cli command
php artisan invoices:migrate
(this command will migrate only package’s table)
- You have to create at least one named pattern, that will be used on invoices. You can create pattern using
php artisan invoices:makePattern “name_of_pattern” “pattern”
- Your pattern have to be string with two slots -> {year} where correct year will be inserted and {number} for invoice number.
- Example:
php artisan invoices:makePattern "eshop" "My-eshop-invoice-{year}/{number}"
Basic usage
- Once instantiated,
InvoiceGenerator
provides public methodgenerateInvoice
- This method requires two parameters, two other are optional
- String name of pattern (invoice line) (required)
- Array of all variables that you want to be printed in provided tempalte. (required)
- String path to your
htm
file that will serve as template. This template should use Twig syntax and at very least define{{ invoice_number }}
where generated invoice number will be printed. (optional) - int invoice number, this will bypass inner invoice number generator (optional)
- Method returns array with
'invoice_number'
and rendered'pdf'
key-value pairs.
Example
$invoice = $invoiceGenerator->generateInvoice("eshop", $templateVariables);
Format of array with variables (all optional)
- Company
- name
- zip
- address
- ico
- dic
- ic_dph
- bank
- account_number
- iban
- swift
- delivery_address
- first_name
- last_name
- address
- zip
- city
- country
- billing_address
- first_name
- last_name
- address
- zip
- city
- country
- ic
- dic
- updated_at
- variants
- variant
- ean
- name
- quantity
- price
- price_without_tax
- sum_without_tax
- tax
- sum
- …
- variant
- delivery_option
- name
- price
- price_without_tax
- tax
- sum
- sum_without_tax
- sum_tax_only
- sum
- currency (currency symbol)
- status [‘canceled’, ‘refunded’] -> leave empty when neither of these