Skip to content
📝 PDF invoice generator
Branch: master
Clone or download
Latest commit 577cec3 Jul 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
assets PDF renderer replaced instead of image renderer May 20, 2018
src DefaultTemplate: itemsPerPage is variable Jul 8, 2019
tests
.gitignore refactoring Jun 1, 2017
.travis.yml contributte Feb 27, 2019
README.md Travis CI: fix badge, create missing directories for tests (#8) Mar 11, 2019
codeception.yml add calculators, refactoring [fixed #7][BC break] Feb 27, 2019
composer.json Add master alias Jul 9, 2019
ruleset.xml contributte Feb 27, 2019
run-tests.sh DefaultTemplate adjustments May 21, 2018

README.md

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

You can’t perform that action at this time.