1. Go to this page and download the library: Download imos/invoice 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/ */
imos / invoice example snippets
ini_set('bcmath.scale', 10);
// OR
bcscale(10);
$lineItem = (new LineItem)
->setDescription('Internet Widget')
->setReference('IW-42')
->setQuantity(2)
->setUnit('pc.')
->setUnitPrice(25)
->setTaxRate(19) // 19%
->setTaxName('VAT (DE)')
->setDiscount(20); // 20%
$lineItemTotal = $lineItem->getTotal(); // Get the line total
$invoice = (new Invoice)
->setPriceType(Invoice::PRICE_NET)
->setCurrency('EUR')
// The number of decimal places used can be set with the second parameter
// ->setCurrency('JPY', 0)
->setCustomerAddress(array(
'imos GmbH',
'Alfons-Feifel-Str. 9',
'73037 Göppingen',
))
->setCustomerNumber('99999')
->setInvoiceNumber('RE-1234')
->setInvoiceDate(new DateTime)
->setDueDate(new DateTime('+30 days'))
->setBillingPeriod(DateRange::create('2016-01-01', '2016-02-01'))
->setCommission('ACME Partner')
->addTaxId('VATIN', 'DE999999999')
->addTaxId('Steuernummer', '12345 / 67890')
->setPaymentTerms('30 days strictly net')
->addExtraInfo('Payable by bank transfer.')
->addExtraInfo('IBAN: DE99 1234 5678 9012 3456 78')
// Add line items
->addLineItem($lineItem)
->addLineItem($lineItem);
$netTotal = $invoice->getTotal(Invoice::PRICE_NET); // 40
$grossTotal = $invoice->getTotal(Invoice::PRICE_GROSS); // 47.6
$invoice->addExtraInfo('This invoice covers services rendered {{billingPeriod}}.');
$invoice->addExtraInfo('Please transfer {{totalGross}} to our account by {{dueDate}}, ' .
'using "{{customerNumber}} / {{invoiceNumber}}" as the reference.');
$generator = new HtmlGenerator(new Formatter);
echo $generator->generate($invoice);