PHPackages                             curiousteam/laravel-pdf-drivers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [PDF &amp; Document Generation](/categories/documents)
4. /
5. curiousteam/laravel-pdf-drivers

ActiveLibrary[PDF &amp; Document Generation](/categories/documents)

curiousteam/laravel-pdf-drivers
===============================

Driver-based PDF generator for Laravel (mPDF, Dompdf, Html2Pdf) with a unified API.

v1.0.1(10mo ago)16[1 PRs](https://github.com/curiousteam/laravel-pdf-drivers/pulls)MITPHPPHP ^8.2

Since Sep 3Pushed 3mo agoCompare

[ Source](https://github.com/curiousteam/laravel-pdf-drivers)[ Packagist](https://packagist.org/packages/curiousteam/laravel-pdf-drivers)[ Docs](https://github.com/curiousteam/laravel-pdf-drivers)[ RSS](/packages/curiousteam-laravel-pdf-drivers/feed)WikiDiscussions main Synced today

READMEChangelog (2)Dependencies (4)Versions (4)Used By (0)

Driver-based PDF generator for Laravel (mPDF, Dompdf, Html2Pdf) with a unified API.
===================================================================================

[](#driver-based-pdf-generator-for-laravel-mpdf-dompdf-html2pdf-with-a-unified-api)

[![Latest Version on Packagist](https://camo.githubusercontent.com/12a6223fdbe4c22d29bf7ab47c6ad5a3581e960197d71c94075fcee4511e1871/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f637572696f75737465616d2f6c61726176656c2d7064662d647269766572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/curiousteam/laravel-pdf-drivers)[![Total Downloads](https://camo.githubusercontent.com/0614b5f97230b9d8684921cd1e3cd77a0eb2dfc81eea4d9ed1cc8eea640df799/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f637572696f75737465616d2f6c61726176656c2d7064662d647269766572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/curiousteam/laravel-pdf-drivers)

A simple, driver-based PDF generation manager for Laravel.
Supports multiple PDF libraries (drivers) such as **mPDF**, **Dompdf**, **TCPDF**, and more.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require curiousteam/laravel-pdf-drivers
```

You can publish the config file with:

```
php artisan vendor:publish --provider="Curiousteam\LaravelPdfDrivers\PdfServiceProvider" --tag="config"
```

If you are on Laravel &lt; 5.5, you need to manually register the service provider:

```
// config/app.php
'providers' => [
    Curiousteam\LaravelPdfDrivers\PdfServiceProvider::class,
],
```

---

Configuration
-------------

[](#configuration)

After publishing, you’ll get a config file at `config/pdf.php`:

```
return [

    'driver' => env('PDF_DRIVER', 'mpdf'), // dompdf|mpdf|html2pdf

    'drivers' => [

        'dompdf' => [
            'options' => [
                'isHtml5ParserEnabled' => true,
                'isRemoteEnabled' => true,
                'defaultFont' => 'DejaVu Sans',
            ],
            'paper' => ['size' => 'A4', 'orientation' => 'portrait'],
        ],

        'mpdf' => [
            'options' => [
                'mode' => 'utf-8',
                'format' => 'A4',
                'tempDir' => storage_path('app/mpdf-temp'),
                'default_font' => 'dejavusans',
            ],
            'paper' => ['size' => 'A4', 'orientation' => 'landscape'],
        ],

        'html2pdf' => [
            'options' => [
                'format' => 'A4',
                'orientation' => 'P',
                'language' => 'en',
                'unicode' => true,
                'encoding' => 'UTF-8',
                'margins' => [10, 10, 10, 10],
            ],
            'paper' => ['size' => 'A4', 'orientation' => 'portrait'],
        ],

    ],

];
```

---

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

```
use Curiousteam\LaravelPdfDrivers\Facades\Pdf;

Route::get('/download-report', function () {
    $html = view('templates.pdf.reports.example', ['title' => 'Laravel PDF Driver'])->render();

    return Pdf::loadHTML($html)
        ->download('report.pdf');
});
```

### Streaming PDF in Browser

[](#streaming-pdf-in-browser)

```
return Pdf::loadView('templates.pdf.reports.invoice', ['invoice' => $invoice])
    ->stream('invoice.pdf');
```

### Saving PDF to Disk

[](#saving-pdf-to-disk)

```
Pdf::loadHTML('Hello CuriousTeam')
    ->save(storage_path('app/reports/hello.pdf'));
```

---

Switching Drivers
-----------------

[](#switching-drivers)

Default installed driver is: **mpdf**

To use other driver (`Dompdf\Dompdf` or `Spipu\Html2Pdf`), you need to install the package via composer first:

```
composer require dompdf/dompdf
```

Or,

```
composer require spipu/html2pdf
```

Then, you can easily switch drivers at runtime:

```
$pdf = Pdf::driver('dompdf')
    ->loadView('reports.test')
    ->download('test.pdf');
```

Or, even dynamically in `.env`:

```
PDF_DRIVER=dompdf
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Curious Team](https://github.com/curiousteam)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance70

Regular maintenance activity

Popularity6

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

304d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/29994885?v=4)[MD RUBEL MIYA](/maintainers/curiousteam)[@curiousteam](https://github.com/curiousteam)

---

Top Contributors

[![curiousteam](https://avatars.githubusercontent.com/u/29994885?v=4)](https://github.com/curiousteam "curiousteam (17 commits)")

---

Tags

laraveldompdfmpdfhtml2pdfcuriousteamlaravel-pdf-drivers

### Embed Badge

![Health badge](/badges/curiousteam-laravel-pdf-drivers/health.svg)

```
[![Health](https://phpackages.com/badges/curiousteam-laravel-pdf-drivers/health.svg)](https://phpackages.com/packages/curiousteam-laravel-pdf-drivers)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3355.3M346](/packages/psalm-plugin-laravel)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k95.4M306](/packages/laravel-horizon)[laravel/sail

Docker files for running a basic Laravel application.

1.9k205.7M1.3k](/packages/laravel-sail)[illuminate/database

The Illuminate Database package.

2.8k54.9M11.6k](/packages/illuminate-database)[laravel/ai

The official AI SDK for Laravel.

1.0k3.2M194](/packages/laravel-ai)[moonshine/moonshine

Laravel administration panel

1.3k253.1k81](/packages/moonshine-moonshine)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
