setasign/fpdf
FPDF is a free PHP class for generating PDF files with pure PHP. Clone of official releases, installable via Composer as setasign/fpdf. No active development in this repository.
Build vs. buy, resolved cheaply for a narrow class of documents. FPDF is the lowest-cost credible path to shipping a server-side PDF capability: pure PHP, zero extensions required beyond GD/FreeType for images and embedded fonts, no external rendering service, no per-page billing, no vendor contract. It converts "do we need a PDF vendor?" into "can this be a controller method and a queued job?" — and for a well-bounded set of documents, the answer is yes.
Caps the feature envelope early, which is the point. Choosing FPDF is an explicit decision to trade design flexibility for zero infrastructure and zero cost. It is a positioning API, not a templating engine: documents are laid out imperatively in PHP (Cell, MultiCell, SetXY), with no HTML/CSS/Blade path. That constraint is useful forcing function — it makes "do we need branded, designer-owned, multi-language PDFs?" a scoping conversation on day one rather than a QA surprise in week six.
Use cases it credibly unlocks (MVP through v1):
eval-based PDF generators) onto a Composer-installable, version-pinned dependency.Cost and lock-in decisions. Eliminates licensing spend and per-page API billing, and removes a third-party availability dependency from the critical path of invoice delivery. The cost migrates from a recurring line item to engineering hours — budget layout work as real scope, because manual coordinate arithmetic is routinely underestimated by 3–5×.
The caveat to surface before committing. This repository is a mirror of official FPDF releases and states plainly that no development happens here. That is not disqualifying — PDF 1.x output is a frozen target and a frozen dependency is a legitimate choice — but the honest framing is "we are adopting a finished, unmaintained library," not "we are adopting a maintained product." Nobody should expect a roadmap, upstream feature requests, or a security response. Separately, the NOASSERTION licence flag is a tooling artefact of FPDF's own permissive "free for any usage" terms, not an unknown licence — but get a short legal confirmation before it touches customer-facing or contractual output, and expect the question again at every security review.
Adopt when most of these are true:
wkhtmltopdf binary in the container, no API key to rotate.Look elsewhere when any of these is true — these are disqualifiers, not trade-offs:
barryvdh/laravel-dompdf, or spatie/laravel-pdf for CSS fidelity), not cell arithmetic.Practical adoption conditions: pin the version, keep it behind one PdfGenerator contract bound in a service provider, vendor the font metrics you rely on, and add golden-file/visual-diff tests before the second template ships. Treat it as a stable primitive rather than a dependency you will upgrade into new capability.
To executives: "We can ship PDF invoices and reports entirely in-house — no third-party rendering service, no per-document fees, no new infrastructure, no vendor contract. It's a small, free, self-contained PHP library that runs inside our existing Laravel app. The cost is a few days of engineering for the layout, not a recurring line item, and it removes an external availability dependency from invoice delivery. It is deliberately basic: the right tool for documents whose structure we control, like receipts, statements, and internal reports. For anything that must match our website design, support non-Latin languages, or carry digital signatures, I'd recommend a different tool — and I'd rather make that call now than after we build. One housekeeping item: legal needs a short confirmation on the licence wording before it reaches customers."
To engineering: "Pure-PHP PDF writer, Composer-installable, no extensions beyond GD/FreeType for images and custom fonts. It's frozen — this repo mirrors the official FPDF releases and takes no patches, so we pin it and own it. Good at: invoices, receipts, fixed-format reports where we want explicit positional control. Bad at: HTML templating, UTF-8, forms, and anything with flowing text — those are scope decisions, not sprint-2 discoveries. Plan to wrap it in one PdfGenerator contract, subclass it for shared headers/footers, and run generation in a queued job that streams straight to S3 so we never hold large documents in the request cycle. Two risks to own up front: legal confirmation on the non-SPDX licence, and Unicode as a hard blocker rather than a workaround. If either fails, the swap to mPDF or Dompdf is contained to that one class. Also worth naming: the metadata is misleading — 780 stars and zero dependents describe a mirror, so treat this as a supply-chain dependency with a named owner, not a community project with momentum."
To the team asking for the feature: "You'll have PDF invoices next sprint. They'll be clean and consistent, but they won't be a redesign — the layout is built in code, not handed over as a design file. If you want a new visual treatment later, that's a follow-up conversation about tooling, not a tweak."
How can I help you explore Laravel packages today?