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
Dompdf Bundle

Dompdf Bundle Laravel Package

slik/dompdf-bundle

Symfony bundle that integrates the Dompdf library to generate PDFs from HTML. It provides a service for rendering HTML templates into PDF documents in Symfony applications, with configurable options and straightforward setup.

View on GitHub
Deep Wiki
Context7

With this bundle you can easily use DOMPDF to generate pdf documents from anywhere in Symfony2

Frequently asked questions about Dompdf Bundle
Does slik/dompdf-bundle work with Laravel?
No. It is a Symfony 2 bundle built around a Bundle subclass, a DI extension that reads the slik_dompdf config tree, and service-container wiring; Laravel has no bundle or kernel-bundle concept, so none of that code is loadable or adaptable. For Laravel, use barryvdh/laravel-dompdf or bind dompdf/dompdf directly in a service provider.
How do I install and configure slik/dompdf-bundle in a Symfony app?
You add it with Composer, register the bundle in AppKernel, define your settings under the slik_dompdf configuration key, and then pull the Dompdf service from the container when rendering. This only applies to legacy Symfony 2 projects, since the package targets Symfony ~2.3|~2.7. It has no equivalent install path in Laravel.
What is the Laravel equivalent of slik/dompdf-bundle?
barryvdh/laravel-dompdf is the closest maintained equivalent: a thin Laravel wrapper over dompdf/dompdf 3.x with a publishable config file, a facade, and container binding. If you need to match the exact Dompdf output of a legacy Symfony system, either that package or a hand-written binding will do. If you want modern CSS support, spatie/laravel-pdf is the better fit.
Is slik/dompdf-bundle safe to use in production?
Not for new work. The repository has roughly nine stars and zero dependents, Symfony 2 reached end of maintenance in November 2018, and its constraints pin an old pre-2.x Dompdf release with known advisories around local file disclosure, phar deserialization, and remote resource/SSRF handling. Rendering user-supplied HTML through an unpatched PDF engine in the request path is not acceptable, and there is no realistic expectation that a security report against this bundle would be answered.
How do I migrate a slik_dompdf configuration to Laravel?
Treat the bundle as a specification rather than a dependency. Extract the keys the legacy application actually sets, such as orientation, default paper size, enable_remote, font_dir, temp_dir, base path, DPI, and font cache, plus any custom fonts committed to the repo. Recreate those as config/pdf.php and a single PdfRenderer service that wraps whichever engine you choose, so application code never depends on Dompdf directly.
Can I use dompdf/dompdf directly in Laravel without a wrapper package?
Yes. Require dompdf/dompdf ^3 and register a singleton in a service provider, roughly thirty lines, passing your options array to the Dompdf constructor. You get full version control and no third-party wrapper, at the cost of writing and maintaining that thin binding yourself.
How do I set paper size, orientation, and custom fonts for Dompdf in Laravel?
With barryvdh/laravel-dompdf, publish config/dompdf.php and set paper, orientation, defaultFont, font_dir, and enable_remote there; those map to standard Dompdf options. Custom fonts need to be registered with the font metrics and cache directory and be readable at render time. These are the same option names the Symfony bundle exposed, so legacy slik_dompdf settings translate directly.
How do I test PDF generation in a Laravel application?
Assert the route returns 200 with an application/pdf content type, then inspect the bytes: check the %PDF header, count pages with a parser, and confirm key text appears using pdftotext or a similar library. When reproducing a legacy Symfony system, keep golden rendered-document fixtures and compare page count and extracted text rather than raw bytes, because output varies by engine version.
Should I use headless Chrome instead of Dompdf for HTML to PDF in Laravel?
For new work, often yes. spatie/laravel-pdf uses Browsershot to render through Chromium, which handles flexbox, CSS grid, and modern typography far better than Dompdf and moves the library out of your trust boundary. The tradeoffs are a Node and Chromium dependency in your container image, higher memory use, and slower cold renders. Keep Dompdf when you need a small footprint or output fidelity with an existing Dompdf system.
Why doesn't slik/dompdf-bundle install with Composer in a modern Laravel app?
Its Symfony ~2.3|~2.7 and PHP 5.x/7.0-7.1 constraints conflict with the PHP and Symfony component versions a current Laravel release requires, so dependency resolution fails. Forcing it through with --ignore-platform-reqs would leave an unpatched Dompdf release in your request path. If the real goal is reproducing the bundle's output, port the configuration and templates instead of the dependency.
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.
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource
noith/settings
kda/laravel-package
kda/filament-dynamic-navigation
bypersoft/signbox
pairus/product-data
fayne/laravel-filament-cms-core