Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Dompdf Laravel Package

barryvdh/laravel-dompdf

Laravel wrapper for Dompdf that turns HTML and Blade views into downloadable PDFs. Simple facade and config make it easy to add headers, footers, page numbers, and custom paper sizes to invoices, reports, and other documents.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Build vs. buy for document generation: This package removes the need to build a rendering pipeline or buy a third-party PDF API for the common case — HTML/Blade templates rendered to PDF server-side, in-process, with no external binaries. That is a meaningful engineering-cost and vendor-cost saving, and it keeps document content inside our infrastructure (relevant for invoices, statements, medical/HR records).
  • Feature scoping for "documents" epics: It directly enables invoices, receipts, order confirmations, packing slips, statements, payslips, certificates, tickets, and scheduled report exports. For most B2B SaaS roadmap items, this is the default answer to "can we ship PDF output this quarter?"
  • Roadmap sequencing of value-adds: Because it renders HTML/CSS, templating, branding, localization, and layout iteration become normal frontend/Blade work rather than PDF-engine work. That lets us sequence customer-facing polish (branded header/footer, page numbers, T&Cs, multi-language) without re-platforming.
  • Architectural decisions: It favors a queue-based, background-generation model (render off the request path, store to object storage, email a signed link) — a decision worth making once, early, so slow or large documents never block a web request.
  • Pricing and packaging: Low marginal cost per document means we can include PDF export in lower tiers or as an unlimited feature rather than metering it, which is often a competitive differentiator against tools that charge per document.
  • Risk/upgrade planning: The 3.x line made security-sensitive defaults safer (enable_remote now false, plus allowedRemoteHosts and artifactPathValidation). This is a positive signal for a security review, but it also means upgrade work is real — budget an owner and a maintenance slot each time the upstream DOMPDF major moves.

When to Consider This Package

Adopt when:

  • We are on a supported Laravel/PHP combination (3.x requires Laravel 9+ / PHP 8.1+, and the latest release tests against Laravel 13 and PHP 8.5) — check this first.
  • Documents are template-driven and text/CSS-heavy: invoices, statements, reports, letters, labels, certificates.
  • No JavaScript execution is needed to produce the layout. DOMPDF does not run JS; anything chart- or widget-driven must be pre-rendered to an image or a static chart.
  • We want pure-PHP, dependency-light deployment — no headless browser, no wkhtmltopdf binary, no container image bloat, works where shelling out is awkward.
  • Moderate volumes with acceptable latency, and a clear place to run generation asynchronously.
  • Unicode/multi-language output matters — font handling and cached font metrics are supported, though font embedding and RTL should be validated with a spike before committing.
  • We accept MIT licensing terms and want a vendor we can fork or patch if needed.

Look elsewhere when:

  • Design fidelity is the product. Modern CSS (flexbox/grid nuances, advanced selectors, complex floats, web fonts, CSS variables) is inconsistently supported. Pixel-perfect, print-production-grade output implies a headless Chrome approach (e.g., Browsershot/Puppeteer) or a commercial rendering service.
  • High throughput or very large documents. Rendering is CPU- and memory-bound; long tables and hundreds of pages are a known pain point. If we need thousands of documents per hour or 500-page catalogs, benchmark hard or choose a different engine.
  • Archival/compliance formats: PDF/A, tagged/accessible PDFs (PDF/UA), or true digital signatures are not this tool's strength. If legal, government, or accessibility obligations apply, treat that as a separate, funded workstream.
  • Interactive PDFs — fillable AcroForm fields, embedded JS, or rich annotation workflows.
  • You need someone contractually on the hook. It is a single-maintainer open-source project (albeit a highly reputable one) with no SLA. If the document pipeline is revenue-critical and cannot tolerate community-only support, pair it with an internal owner or a commercial alternative.
  • Security posture around untrusted input is unresolved. If we plan to render user-supplied HTML, the SSRF/local-file-read surface is real; adopting without an owner who understands enable_remote, allowedRemoteHosts, allowed_protocols, and artifactPathValidation is a mistake.

Two practical adoption criteria worth writing into the decision record: (1) we pin the major version and schedule upgrades rather than drifting, and (2) if we publish the config file, we own it — the 3.1 release note is explicit that published configs must be manually updated (e.g., adding the data:// scheme), and stale published config is the most likely cause of a "PDFs suddenly render without images" incident. Also note the "Dependents: 0" figure appears to be a registry artifact, not a real signal of low adoption; 7.3k stars and years of consistent releases are the better evidence.

How to Pitch It (Stakeholders)

For executives: This is a mature, MIT-licensed, zero-cost component that lets us ship branded PDF documents — invoices, statements, reports, confirmations — inside the product without buying a per-document vendor service. It is one of the most widely used packages in the Laravel ecosystem (~7.3k stars), actively maintained, and the latest releases explicitly support current Laravel and PHP versions. Cost is engineering time, not licences. The main caveat to state plainly: it is excellent for business documents, not for pixel-perfect marketing collateral or regulated archival formats — so we should scope it to the former and not promise the latter.

For engineering: A thin, well-maintained wrapper over dompdf/dompdf that gives us Blade-templated HTML → PDF with a clean facade, configurable paper size/orientation, per-call option overrides (setOption), and streaming or download responses. It is pure PHP, so no binary or container changes. Requirements: Laravel 9+/PHP 8.1+ (latest release tests through Laravel 13 and PHP 8.5). We should generate asynchronously on queues, keep templates simple and CSS conservative, embed fonts deliberately, and never feed it untrusted HTML without hardening the remote/protocol/artifact options. Note the 3.x defaults are deliberately safer (enable_remote off), so remote images must be explicitly allow-listed — plan for that in the first implementation rather than discovering it in QA. Upgrade path is bounded: majors follow upstream DOMPDF majors, so treat each major as a scheduled piece of work with a config diff, and keep config/dompdf.php under review if published.

Bottom line / ask: Approve it as the standard document-rendering component for transactional and reporting PDFs, with three conditions — a named owner for dependency and config upkeep, background generation from day one, and an explicit exclusion of pixel-perfect/PDF-A/accessibility-tagged use cases from this scope.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package