Statistics
150
44
4
28d
Badges
Dependencies

Build Status

PHP Invoice

Average output ~20ms

Installation

php 7.1

composer require contributte/invoice

Usage

Company

$company = new Contributte\Invoice\Data\Company('John Doe', 'Los Angeles', 'Cavetown', '720 55', 'USA', '0123456789', 'CZ0123456789');

Customer

$customer = new Contributte\Invoice\Data\Customer('John Doe', 'Los Angeles', 'Cavetown', '720 55', 'USA');

Account

$account = new Contributte\Invoice\Data\Account('1111', 'CZ4808000000002353462015', 'GIGACZPX');

Payment info

$payment = new Contributte\Invoice\Data\PaymentInformation('', '0123456789', '1234', 0.21);

Order

$order = new Contributte\Invoice\Data\Order('20160001', new \DateTime('+ 14 days'), $account, $payment);

Adding items

$order->addItem('Logitech G700s Rechargeable Gaming Mouse', 4, 1790);

Customizing

class CustomFormatter implements IFormatter {
	
}

Generating invoices

$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));

Generating preview

$invoice->send(Contributte\Invoice\Preview\PreviewFactory::createCustomer(), Contributte\Invoice\Preview\PreviewFactory::createOrder());

Nette DI

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) {
		// ...
	}
}

Previews

First page: first page

Second page: second page

Is this addon outdated? Did you find an issue? Please report it.

Componette Componette admin@componette.com