PHP code example of byrokrat / billing
1. Go to this page and download the library: Download byrokrat/billing 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/ */
byrokrat / billing example snippets
namespace byrokrat\billing;
use byrokrat\amount\Currency\EUR;
// 1 unit of a 100 EUR item with 25% VAT
$item = new Item('Description', new EUR('100'), 1, .25);
$invoice = (new InvoiceBuilder)
->setSerial('1')
->setSeller(new Agent('Company X'))
->setBuyer(new Agent('Mrs Y'))
->generateOcr()
->addItem($item)
->setAttribute('message', 'custom invoice message')
->buildInvoice();
// prints 125 (100 EUR plus 25% VAT)
echo $invoice->getInvoiceTotal();