# Fagus
> HTML and CSS to PDF for PHP and Laravel, without a browser: a Composer package with a native engine written in Rust that renders the way Chrome prints, with PDF/A, PDF/UA and ZUGFeRD/Factur-X.
Documentation of the latest release (v0.1.0). Install with `composer require nforst/fagus` (PHP 8.3 or newer; Laravel 13 registers it on its own). Every page below is plain Markdown; https://fagus.niklasforst.de/llms-full.txt contains all of them. The MCP server https://fagus.niklasforst.de/docs/mcp (Streamable HTTP, no authentication) searches the documentation of the latest release. Source code: https://github.com/nforst/fagus.
## Docs
- [Overview](https://fagus.niklasforst.de/docs/index.md): Fagus turns HTML and CSS into PDF for PHP and Laravel, the way Chrome prints them, without a browser. Getting started, references and the PDF it writes.
- [Getting started](https://fagus.niklasforst.de/docs/getting-started.md): Requirements, installing the Composer package nforst/fagus and the first PDF in PHP and in Laravel. No browser, Node or Docker image to install.
- [PHP API](https://fagus.niklasforst.de/docs/php.md): The PHP API of Fagus: the document builder, the PDF it renders to, the engine that runs the binary as a worker process, diagnostics and exceptions.
- [Laravel](https://fagus.niklasforst.de/docs/laravel.md): The Laravel integration of Fagus: the facade, Blade views, inline and download responses, filesystem disks, queues, Octane and the configuration.
- [Resources](https://fagus.niklasforst.de/docs/resources.md): Where images, style sheets, fonts and frames come from, and what Fagus never loads: no network access, no files outside the directory you allow, no scripts.
- [Deployment](https://fagus.niklasforst.de/docs/deployment.md): Install the fagus binary in CI and Docker builds, on Alpine, on servers without access to GitHub or from a build of your own; worker processes, speed, memory.
- [Troubleshooting](https://fagus.niklasforst.de/docs/troubleshooting.md): Error messages and what to do about them, diagnostics, differences from Chrome, and moving from Dompdf, mPDF, Browsershot or Snappy.
- [CSS reference](https://fagus.niklasforst.de/docs/css.md): What Fagus supports of CSS, grouped by topic, where it differs from Chrome in print and what it does not support. Chrome 157 on Linux is the reference.
- [Paged media](https://fagus.niklasforst.de/docs/paged-media.md): Page sizes and margins, headers and footers, page numbers, page breaks, tables across pages, tables of contents and print shop marks, all from CSS.
- [Fonts](https://fagus.niklasforst.de/docs/fonts.md): The built-in font, font directories, @font-face, system fonts, fallback for missing characters, OpenType features and languages, and fonts in the PDF.
- [Extensions](https://fagus.niklasforst.de/docs/extensions.md): What Fagus adds where CSS has no way, prefixed with -fagus-: carry-over rows with the running total where a table breaks across pages (Übertrag).
- [The PDF](https://fagus.niklasforst.de/docs/pdf.md): Metadata, links and the outline, tagged and accessible PDF (PDF/UA), PDF/A, attachments, ZUGFeRD and Factur-X invoices, and reproducible output.
- [Command line](https://fagus.niklasforst.de/docs/cli.md): The fagus binary renders HTML files to PDF on the command line, exactly as the PHP package does: options, exit codes, examples, threads and the worker.
- [Rust library](https://fagus.niklasforst.de/docs/rust.md): Render PDFs inside a Rust program with the crate fagus, the engine the PHP package and the command line tool are built on, without a separate process.
## Optional
- [Worker protocol](https://fagus.niklasforst.de/docs/protocol.md): fagus worker renders documents for a caller over standard input and output. One process serves any number of documents one after another, with fonts loaded and caches warm, so a document costs the time it takes to …
- [Releasing](https://fagus.niklasforst.de/docs/releasing.md): A release consists of the fagus binary for every platform, attached to a GitHub release of nforst/fagus, and the Composer package nforst/fagus, which installs the binary of its release and accepts no other: …
- [1. Record architecture decisions](https://fagus.niklasforst.de/docs/adr/0001-record-architecture-decisions.md): Fagus is a long-running project with many decisions whose reasons get lost if they only live in conversations.
- [2. Rust core with fragmentation inside layout](https://fagus.niklasforst.de/docs/adr/0002-rust-and-fragmentation-in-layout.md): Measurements on 2026-11-01 (see bench/README.md) compared PlutoBook (C++), fulgur, fullbleed and ironpress (Rust), mPDF (PHP) and Chrome.
- [3. lightningcss for parsing, own selector matching and cascade](https://fagus.niklasforst.de/docs/adr/0003-css-parsing-and-own-selector-matching.md): lightningcss (MPL-2.0) parses stylesheets into typed values, including modern colors (oklch(), color-mix()), nesting, @layer, @property, @container and @page margin rules.
- [4. Extensions only where CSS has no way](https://fagus.niklasforst.de/docs/adr/0004-extensions-only-where-css-has-no-way.md): Fagus renders CSS as browsers and the print specifications define it. Some documents need things that no CSS specification offers.
- [Changelog](https://fagus.niklasforst.de/changelog): what changed in each release