tfox/mpdf-port-bundle
A Symfony bundle that integrates the mPDF library, providing service configuration and a straightforward way to generate PDFs from HTML in Symfony applications.
Feature and roadmap decisions this evaluation unlocks
{PAGENO}/{nbpg} page tokens, watermarks, barcodes, bookmarks, and auto-generated tables of contents. That maps directly onto invoicing, multi-language statements, and long policy documents.PdfRenderer interface from day one.Consider the underlying engine (mPDF — not this bundle) when:
Do not adopt this specific package when:
Symfony\Component\HttpKernel\Bundle\Bundle, Extension/Configuration, and Resources/config/services.yml. Laravel's container understands none of that. There is no consumption path — installing it alongside Laravel 10/11 will conflict on symfony/* transitive constraints and fail Composer resolution. Use mpdf/mpdf directly behind your own service provider.Minimum due-diligence gates before any mPDF commitment:
To executives (30 seconds) "We need to produce invoices and statements as PDFs. There are two ways to buy that: pay per-document licensing to a hosted rendering service, or render in-process in PHP. The second keeps infrastructure cost near zero and keeps customer financial data inside our own application, which matters for compliance. The engine that makes that possible — mPDF — is mature open source with genuinely good multilingual and page-layout support. The specific package in front of us is only a small Symfony convenience wrapper for it, and it is unmaintained with no users: it is not usable in our Laravel stack. My recommendation is to adopt the engine, not the wrapper. One to three days of our own integration code gives us the same result without putting a dead dependency on the critical path of billing documents."
To engineering
mpdf/mpdf at the current stable release, with a PHP 8.2+/Laravel 10/11 compatibility and security-advisory check before it hits the lockfile.MpdfServiceProvider binding a configured renderer as a singleton, a config/pdf.php for fonts/temp dir/margins/defaults, and a facade or injected interface at call sites. Its config defaults are worth capturing as a short spec document — that document is the real deliverable.PdfRenderer::render(string $html, array $options): string. This is the single highest-leverage decision, because it turns a future engine swap (mPDF → Gotenberg/Browsershot) from a refactor into a config change.Recommendation: No-go on this package. Go on mPDF as the v1 engine behind our own thin PdfRenderer abstraction, shipped first behind a queue job and a feature flag, with a documented exit ramp to a headless-Chrome renderer if design requirements escalate.
How can I help you explore Laravel packages today?