// the find
KnpLabs/snappy
PHP library allowing thumbnail, snapshot or PDF generation from a url or a html page. Wrapper for wkhtmltopdf/wkhtmltoimage
Snappy is a PHP wrapper around wkhtmltopdf/wkhtmltoimage that turns URLs or HTML strings into PDFs and images. It's been the standard go-to for PHP PDF generation for over a decade. The library itself is tiny — nearly all the real work is done by the wkhtmltox binary it shells out to.
- Dead simple API: pass a URL or HTML string, get back a PDF. The option passthrough to wkhtmltopdf flags is straightforward and well-documented.
- Solid framework integrations exist for both Symfony and Laravel, so you're not wiring this up from scratch in the common PHP stacks.
- The README's security warning about --enable-local-file-access is honest and specific — credits the researcher, links to official recommendations. That's better than most wrappers.
- wkhtmltopdf is effectively a dead project — Qt WebKit, abandoned since 2020, no longer maintained. Modern CSS (flexbox edge cases, grid, CSS variables) will bite you. The README acknowledges this by pointing at WeasyPrint and Puppeteer as alternatives.
- The h4cc Composer binaries for wkhtmltopdf are extracted from Debian 7 packages, which is comically ancient. Shipping a 2013 binary into production via Composer is a supply chain concern.
- KNPLabs is explicitly looking for maintainers in the README — the project is in low-maintenance mode. Bug fixes depend on whoever volunteers.
- No async or streaming support — everything is synchronous shell_exec under the hood. If you're generating large PDFs under load, you'll need to manage your own queue; the library gives you nothing for that.