flug / invoice
A simple invoice generator
dev-master
2021-09-23 11:39 UTC
Requires
- php: ^7.4
- ext-bcmath: *
- dompdf/dompdf: ^0.8.5 || ^1.0.0
- symfony/twig-pack: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16 || ^3.0
- phpspec/phpspec: ^6.1 || ^7.0
- dev-master
- dev-dependabot/npm_and_yarn/minimist-1.2.8
- dev-dependabot/npm_and_yarn/qs-6.5.3
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/composer/dompdf/dompdf-tw-0.8.5or-tw-1.0.0or-tw-2.0.0
- dev-dependabot/npm_and_yarn/semantic-release-19.0.3
- dev-dependabot/npm_and_yarn/semver-regex-3.1.4
- dev-dependabot/npm_and_yarn/node-fetch-2.6.7
- dev-dependabot/npm_and_yarn/trim-off-newlines-1.0.3
- dev-dependabot/add-v2-config-file
- dev-fix/php-cs-fixer/config
- dev-remove/hirak/prestissimo
This package is auto-updated.
Last update: 2024-12-04 21:46:13 UTC
README
Flug Invoice is a small library/bundle for Symfony to help you generate pdf invoices quickly, it doesn't use wkhtmltopdf but dompdf or you can find the documentation here. you can overload as you want by implementing the interface : "Flug\Invoice\ConfigurationInterface".
The full configuration of dependency injection is available here:
#flug_invoice.yaml flug_invoice: currency: EUR decimal: 2 logo: file: 'https://i.imgur.com/yRb1NQ7.png' height: 60 business_details: name: My Company id: 1234567890 phone: +34 123 456 789 location: Main Street 1st zip: 08241 city: Barcelona country: Spain footnote: '' tax_rates: - {name: '' , tax: 0 , type: percentage} due: format: M dS ,Y date: +3 months with_pagination: true duplication_header: false display_images: true template: '@FlugInvoice/default.html.twig'
The invoice template uses the twigphp/twig rendering engine.
code example :
<?php use Flug\Invoice\Generator\Invoice; use Symfony\Component\HttpFoundation\Response; $invoice = new Invoice(); $invoice->setName('Best Invoice'); $invoice->setNumber((string) 1234556325); $invoice->setDate(new \DateTimeImmutable()); $invoice->setCustomerDetails('Best Customer', (string) 1234556, '+33 630301023', '44000', 'Nantes', 'France', '36 quai des orfèvres'); $invoice->addItem('Test Item', 10.25, 2, 1412) ->addItem('Test Item 3', 15.55, 5, 42) ->addItem('Test Item 4', 1.25, 1, 923) ->addItem('Test Item 5', 3.12, 1, 3142) ->addItem('Test Item 6', 6.41, 3, 452) ->addItem('Test Item 7', 2.86, 1, 1526) ->addItem('Test Item 8', 5, 2, 923, 'https://dummyimage.com/64x64/000/fff') ->setNotes('toto notes <br>'); $renderer = $this->pdf->generate($invoice); $stream = $renderer->output(); return new Response($stream, 200, ['Content-type' => 'application/pdf']);
More tests are coming soon...