Generating PDFs in Laravel has historically forced developers to choose between two painful trade-offs:
- Pure-PHP tools (Dompdf, mPDF): They struggle or completely break on modern CSS like Flexbox, CSS Grid, and Tailwind CSS.
- Node-based bridges (Browsershot, Puppeteer): They require running and maintaining a full Node.js / NPM sidecar runtime on your production web server.
To solve this, we built zentiq-labs/laravel-fast-pdf — an open-source Laravel bridge designed for high-performance PDF rendering directly from Blade views.
How It Works
Instead of spawning a heavy Node.js process, laravel-fast-pdf connects directly to the server's headless Chromium binary via Inter-Process Communication (IPC). You get pixel-perfect modern CSS/Tailwind rendering at sub-second speeds, without needing Node.js or Puppeteer installed on your server.
Installation
Install the package via Composer:
composer require zentiq-labs/laravel-fast-pdf
Make sure Chromium or Google Chrome is installed on your server:
sudo apt install chromium-browser
Usage
Generate and download a PDF straight from a Blade view using the fluent FastPdf facade:
use ZentiqLabs\FastPdf\Laravel\Facades\FastPdf;
class InvoiceController extends Controller
{
public function download(Order $order)
{
return FastPdf::view('invoices.show', ['order' => $order])
->paperSize('A4')
->landscape()
->download("invoice-{$order->id}.pdf");
}
}
Key Features
- Sub-Second Speeds: Instant Blade-to-PDF rendering over server IPC.
- Modern CSS Support: Native rendering for Tailwind CSS, Flexbox, and CSS Grid.
- Zero Node.js Runtime: Only requires the standalone server Chromium binary.
- Laravel 12+ Ready: Includes facade bindings, interface abstractions for easy test mocking, and publishable configuration.
Open Source & Links
- GitHub Repository: https://github.com/zentiqlabs/laravel-fast-pdf
- Packagist: https://packagist.org/packages/zentiq-labs/laravel-fast-pdf
We’d love to hear your feedback! Feel free to drop a star on GitHub or open an issue/PR.
Top comments (0)