Native PHP 8.3+
Built with strict types, zero runtime dependencies, and no external binaries to manage.
No HTML-to-PDF wrappers. No runtime dependencies. Just an immutable document model, a real layout engine, and a template language that compiles to native PHP.
Folio 2.0 is a ground-up redesign. It keeps the zero-dependency, pure-PHP philosophy while adopting an onion/hexagonal architecture, a real layout tree, and a modern template language.
composer require mohammadraufzahed/folioCreate invoice.folio:
prop customer = ""
prop total = ""
page(background="#ffffff") {
column(padding=48, gap=24) {
heading(fontSize=24) "Invoice"
text "Customer: {customer}"
text "Total: {total}"
}
}Render it:
<?php
use Folio\Pdf\Template\TemplateEngine;
$engine = new TemplateEngine();
$pdf = $engine
->enableFolio2Syntax(__DIR__)
->renderFile('invoice.folio', [
'customer' => 'Acme Inc.',
'total' => '$1,250.00',
]);
file_put_contents('invoice.pdf', $pdf);