Average output ~20ms
php 7.1
composer require contributte/invoice
$company = new Contributte\Invoice\Data\Company('John Doe', 'Los Angeles', 'Cavetown', '720 55', 'USA', '0123456789', 'CZ0123456789');
$customer = new Contributte\Invoice\Data\Customer('John Doe', 'Los Angeles', 'Cavetown', '720 55', 'USA');
$account = new Contributte\Invoice\Data\Account('1111', 'CZ4808000000002353462015', 'GIGACZPX');
$payment = new Contributte\Invoice\Data\PaymentInformation('Kč', '0123456789', '1234', 0.21);
$order = new Contributte\Invoice\Data\Order('20160001', new \DateTime('+ 14 days'), $account, $payment);
Adding items
$order->addItem('Logitech G700s Rechargeable Gaming Mouse', 4, 1790);
class CustomFormatter implements IFormatter {
}
$invoice = new Contributte\Invoice\Invoice($company);
header('Content-Type: application/pdf; charset=utf-8');
echo $invoice->create($customer, $order);
shorter
$invoice = new Contributte\Invoice\Invoice($company);
$invoice->send($customer, $order);
nette framework way
$invoice = new Contributte\Invoice\Invoice($company);
$this->sendResponse($invoice->createResponse($customer, $order));
$invoice->send(Contributte\Invoice\Preview\PreviewFactory::createCustomer(), Contributte\Invoice\Preview\PreviewFactory::createOrder());
extensions:
invoice: Contributte\Invoice\DI\InvoiceExtension
invoice:
lang: en
company:
name:
town:
address:
zip:
country:
## Optional
tin:
vaTin:
isTax:
class Component {
public function __construct(Contributte\Invoice\Invoice $invoice) {
// ...
}
}