GithubHelp home page GithubHelp logo

invoice's Introduction

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...

invoice's People

Contributors

dependabot-preview[bot] avatar dependabot[bot] avatar flug avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.