PHP code example of millieofzo / php-invoicer

1. Go to this page and download the library: Download millieofzo/php-invoicer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

millieofzo / php-invoicer example snippets


/* Set badge */
$invoice->addBadge("Payment Paid");

/* Add title */
$invoice->addTitle("Important Notice");

/* Add Paragraph */
$invoice->addParagraph("No item will be replaced or refunded if you don't have the invoice with you. You can refund within 2 days of purchase.");

/* Set footer note */
$invoice->setFooternote("My Company Name Here");

use MillieOfzo\PHPInvoicer\PHPInvoicer;

    $invoice = new PHPInvoicer('','€','en');
    
    /* Header Settings */
    $invoice->setLogo("../examples/images/ti_logo_yellow.png");
    $invoice->setColor("#4d4c59");
    $invoice->setType("Simple Invoice");
    $invoice->setOrderid("2018052100012");
    $invoice->setReference("55033645");
    $invoice->setDate(date('d-m-Y',time()));
    $invoice->setDue(date('d-m-Y',strtotime('+3 months')));
    $invoice->hide_tofrom();
    
    /* Adding Items in table */
    $invoice->addItem("AMD Athlon X2DC-7450","2.4GHz/1GB/160GB/SMP-DVD/VB",2,2);
    $invoice->addItem("PDC-E5300","2.6GHz/1GB/320GB/SMP-DVD/FDD/VB",4,645);
    
      /* Add totals */
    $invoice->addSubTotal();
    $invoice->addVatTotal(21);
    $invoice->addTotal(true);
    
    /* Set badge */
    $invoice->addBadge("Payment Paid");
    
    /* Render */
    /* I => Display on browser, D => Force Download, F => local path save, S => return document path */
    $invoice->render('example2.pdf','I');

use MillieOfzo\PHPInvoicer\PHPInvoicer;

// Default Param: Size: A4, Currency: $, Language: en
$invoice = new PHPInvoicer($size, $currency, $language); 

$invoice->setNumberFormat($decimalpoint, $seperator);

// Hexadecimal color code
$invoice->setColor($color);

$invoice->setLogo($image, $maxwidth, $maxheight);

// A string with the document title, will be displayed
// in the right top corner of the document (e.g. 'Invoice' or 'Quote')
$invoice->setType($title);

// Set order ID of document that will be displayed in
// the right top corner of the document (e.g. '2018052100012')
$invoice->setOrderid($orderid);

// Document reference number that will be displayed in
// the right top corner of the document (e.g. 'INV29782')
$invoice->setReference($number);

//A string with the document's date
$invoice->setDate($date);

// A string with the document's due date
$invoice->setDue($duedate);
// Example
$invoice->setDue(date('d-m-Y',strtotime('+3 months')));


/** Example: */
$invoice->setFrom([
    'My Company',
    'Address line 1',
    'Address line 2',
    'City and zip',
    'Country',
    'VAT number',
    'test'
]);

/** Example */
$invoice->setTo([
   'My Client',
   'Address line 1',
   'Address line 2',
   'City and zip',
   'Country',
   'VAT number',
   '' //Note keep count the same as issuer
]);

$invoice->flipflop();

// $vat and $discount are optional
$invoice->addItem($name,$description,$quantity,$price,$vat = false,$discount = false);

$invoice->addSubTotal();

$invoice->addDiscountTotal($percent);

$invoice->addVatTotal($percent);

$invoice->addTotal($colored);

$invoice->addRow($name,$value,$colored);

$invoice->addBadge($badge, $color);

$invoice->addTitle($title);

$invoice->addParagraph($paragraph);

$invoice->setFooternote($note);

$invoice->render($name, $output);
// Example: 
// $invoice->render('invoice.pdf', 'S')
bash
composer