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

Php Pdf Laravel Package

littlerocket/php-pdf

A lightweight PHP package from littlerocket for generating PDFs with a clean, expressive API. Build documents programmatically, add text, images and pages, then stream or save the output—designed to fit neatly into Laravel applications.

View on GitHub
Deep Wiki
Context7

littlerocket/php-pdf is a lightweight PDF generation library for PHP that lets you build documents programmatically using a clean, chainable API. It focuses on the common cases—text, tables, images, and page layout—without dragging in a heavy dependency tree, making it a practical fit for invoices, reports, and receipts in Laravel or standalone PHP applications.

  • Fluent builder for composing pages, paragraphs, and tables
  • Custom styling for fonts, colors, margins, and headers/footers
  • Multi-page support with automatic pagination and page breaks
  • Image embedding from local paths or streams
  • Framework-friendly integration, with output to file or browser download
Frequently asked questions about Php Pdf
How do I install littlerocket/php-pdf in a Laravel application?
Install it with Composer using composer require littlerocket/php-pdf. The package is framework-agnostic, so it ships no service provider, facade, or publishable config and Laravel will not auto-discover anything. You will need to write your own provider that binds a renderer singleton and externalises font, temp, and cache paths into a config file. Budget a day or two for that integration work before you judge the library itself.
Does littlerocket/php-pdf work with Laravel 10 and Laravel 11?
There are no Laravel or Symfony version constraints in the package, so nothing formally prevents it from installing alongside Laravel 10 or 11. The real question is Composer resolution: this fork inherits transitive imaging and Zend/Laminas-era dependencies from an abandoned upstream, and whether that graph coexists with a Laravel 11 lockfile is unproven. Run a composer why-not spike in a throwaway app pinned to your target version before any design work starts.
What markup does littlerocket/php-pdf use to create PDF documents?
It uses a bespoke XML markup dialect plus a CSS-like stylesheet, which is compiled into a Pdf object graph and then laid out with dynamic page breaking before rendering. It is a document-object-model renderer, not an HTML engine, so the markup you write is not HTML and the styles are not CSS. This is well suited to structured documents such as invoices, statements, contracts, and reports, and poorly suited to pixel-faithful or design-heavy output.
Can I render a Blade view to PDF with littlerocket/php-pdf?
No. The package has no HTML/CSS rendering engine and cannot consume a Blade view directly, so a Blade-to-PDF requirement means rewriting templates in an unfamiliar XML dialect. If your product requirement is essentially render this Blade view to PDF, this package is the wrong shape and you should look at a headless browser or HTML-to-PDF tool instead. Choose it only when the XML document model is a genuine hard requirement.
Which PHP versions does littlerocket/php-pdf support?
The package is described as a PHP 7 fix and the fork is positioned around PHP 8 compatibility with the abandoned psliwa/php-pdf upstream. There is no published CI matrix confirming behaviour on 8.1, 8.2, or 8.3, so treat PHP 8 support as claimed rather than proven. Ask the maintainer exactly what changed, whether the diff is a minimal shim or a rewrite, and whether a test suite runs across your target PHP versions.
Does littlerocket/php-pdf support repeating headers, footers, and bookmarks?
Yes. It is designed for templated, structured documents and handles repeating headers and footers, bookmarks, and dynamic page breaking as part of its layout pass. That makes it a reasonable fit for multi-page invoices, account statements, and contracts that need consistent chrome on every page. Verify the exact markup for each feature against the upstream psliwa/php-pdf documentation, since the fork ships no README excerpt of its own.
How do I generate PDFs with littlerocket/php-pdf inside a queued job?
Wrap generation in a job that resolves your renderer adapter and writes the output to a filesystem or S3 disk, keeping PDF work off the request cycle. Externalise the temp and cache paths through config so concurrent workers do not collide on the same scratch files. Be aware that the memory and wall-clock profile for a large, image-heavy document is undocumented, so benchmark a representative 50-page file before committing to queue timeouts.
Is littlerocket/php-pdf safe to use in production?
Treat it with caution. It is a fork of a long-abandoned upstream with zero stars, zero dependents, no stated CI matrix, no coverage report, no changelog discipline, and no CVE or advisory process for code that parses fonts, decodes images, and performs file I/O. Bus factor is one, and the release metadata looks immature. It is only defensible as a timeboxed spike behind an application-owned interface, not as a strategic dependency.
Is littlerocket/php-pdf a maintained fork of psliwa/php-pdf?
Yes. It is a compatibility fork of psliwa/php-pdf, whose upstream has seen no meaningful feature or security cadence for roughly a decade. The value the fork delivers is PHP 8 compatibility, not ongoing stewardship, and there is no stated maintenance commitment or expected lifetime. Before adopting it, confirm whether the fix will be upstreamed or whether this is a permanent hard fork with no patch path.
What are the alternatives to littlerocket/php-pdf for Laravel PDF generation?
If you need HTML and CSS fidelity, use a browser-based renderer such as Browsershot, a Gotenberg client, or a wkhtmltopdf wrapper, or a pure-PHP HTML engine like dompdf or mPDF. Choose littlerocket/php-pdf only when its XML plus stylesheet document model is a hard requirement that maintained options cannot satisfy. Either way, hide the engine behind an application-owned DocumentRenderer interface so a future swap is a one-class change.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console