lpdfio / lpdf
PHP SDK for Lpdf, the PDF engine that renders a document written in XML or built in code to the same PDF in every language.
v0.37.0
2026-11-21 21:37 UTC
Requires
- php: >=8.2
- ext-dom: *
Requires (Dev)
- phpunit/phpunit: ^11
Suggests
- ext-ffi: Renders in PHP's own process through the native library in the package, with no wasmtime to install: Linux with glibc 2.17 or newer, x86_64 or arm64, and ffi.enable=true for a web server
- ext-posix: Lets the SDK give wasmtime a folder of its own for the engine it compiles, which it needs where PHP's user can't write its home, as www-data under PHP-FPM
Provides
None
Conflicts
None
Replaces
None
- dev-main
- v0.37.0
- v0.36.0
- v0.35.0
- v0.34.0
- v0.33.0
- v0.32.0
- v0.31.0
- v0.30.0
- v0.29.0
- v0.28.0
- v0.27.0
- v0.26.0
- v0.25.0
- v0.24.0
- v0.23.0
- v0.22.0
- v0.21.0
- v0.20.0
- v0.19.1
- v0.19.0
- v0.18.0
- v0.16.0
- v0.15.1
- v0.15.0
- v0.14.0
- v0.13.0
- v0.12.4
- v0.12.3
- v0.12.2
- v0.12.1
- v0.8.0
- v0.7.0
- v0.6.0
- v0.5.0
- v0.2.0
- v0.1.0
- v0.0.3
- v0.0.2
This package is auto-updated.
Last update: 2026-11-21 21:38:09 UTC
README
lpdfio/lpdf
lpdfio/lpdf is the PHP SDK for Lpdf, the PDF engine that renders a document written in XML or built in code to the same PDF in every language.
Installation
composer require lpdfio/lpdf
Usage
use Lpdf\L; use Lpdf\Kit\DocumentAttr; use Lpdf\Kit\LayoutAttr; use Lpdf\Layout\ColumnAttr; use Lpdf\Layout\DividerAttr; use Lpdf\Layout\RowAttr; use Lpdf\Layout\TextAttr; use const Lpdf\NoAttr; $engine = L::engine(); $doc = L::document(new DocumentAttr(size: 'letter'), [ L::section(NoAttr, [ L::layout(new LayoutAttr(margin: '48pt'), [ L::column(new ColumnAttr(gap: '24pt'), [ L::row(new RowAttr(justify: 'between'), [ 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::row(new RowAttr(gap: '12pt', align: 'start'), [ L::text(new TextAttr(color: '#888888', width: '24pt'), ['01']), L::text(new TextAttr(width: 'fill'), ['Discovery & Research']), ]), ]), ]), ]), ]); $pdf = $engine->render($doc);
Requirements
- PHP 8.2 or later, with the DOM extension (
ext-dom; on Debian and Ubuntu it is thephp-xmlpackage) - One of the two ways the SDK runs the engine, which it picks itself (How PHP runs the engine):
- The native library in the package, through PHP's FFI extension (
ext-ffi): on Linux with glibc 2.17 or newer, on x86_64 or arm64. A web server needsffi.enable=truein php.ini; the command line allows FFI as it is. - The
wasmtimecommand-line tool on yourPATH, which runs the bundled WASI binary: everywhere else, such as macOS, Windows and Alpine, and where FFI isn't allowed. On Linux and macOS, where PHP's user can't write its home, aswww-dataunder PHP-FPM, it also needs PHP's POSIX extension (ext-posix), for the SDK's cache folder.
- The native library in the package, through PHP's FFI extension (
Docs
Issues
Report bugs and request features at github.com/lpdfio/lpdf/issues, the one tracker for the engine, the SDKs and the VS Code extension. Pull requests are not accepted.
Licensed under the Lpdf License. See LICENSE for full terms.