Skip to content

Folio 2.0PDF generation for PHP, engineered.

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.

What is Folio 2.0?

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.

Quick start

bash
composer require mohammadraufzahed/folio

Create invoice.folio:

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

Documentation

What's next?

Engineered for teams that care about predictable PDF output.