lpdfio / lpdf
PHP SDK for Lpdf — PDF as Code on every platform. You describe a document as code or XML. Lpdf renders a compact, pixel-perfect PDF — identical across platforms.
v0.7.0
2026-04-30 02:10 UTC
Requires
- php: >=8.2
Requires (Dev)
- phpunit/phpunit: ^11
README
lpdfio/lpdf
PHP SDK for Lpdf — PDF as Code on every platform
You describe a document as code or XML. Lpdf renders a compact, pixel-perfect PDF — identical across platforms.
Installation
composer require lpdfio/lpdf
Usage
use Lpdf\L; use const Lpdf\NoAttr; $engine = L::engine(); $doc = L::document(new DocumentAttr(size: 'letter', margin: '48pt'), [ L::section(NoAttr, [ L::layout(NoAttr, [ L::stack(new StackAttr(gap: '24pt'), [ L::split(NoAttr, [ L::text(new TextAttr(fontSize: '8pt', color: '#888888'), ['ACME CORP']), L::text(new TextAttr(fontSize: '22pt', bold: 'true'), ['Project Proposal']), ]), L::divider(new DividerAttr(thickness: 'xs')), L::text(new TextAttr(fontSize: '13pt', bold: 'true'), ['Scope of Work']), L::flank(new FlankAttr(gap: '12pt', align: 'start'), [ L::text(new TextAttr(color: '#888888', width: '24pt'), ['01']), L::text(NoAttr, ['Discovery & Research']), ]), ]), ]), ]), ]); $pdf = $engine->render($doc);
Requirements
- PHP 8.2+
wasmtimeCLI must be available inPATH(used to run the bundled WASI binary).
Docs
--
Dual-licensed: Community License (free) and Commercial License (paid). See LICENSE for full terms.