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. curiousteam/laravel-pdf-drivers

ActiveLibrary

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

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

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

Since Sep 3Pushed 1mo 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 1mo ago

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

37

—

LowBetter than 83% of packages

Maintenance78

Regular maintenance activity

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

252d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/20480a7f99fbd10639bff6e2f817364e7bd894f0bfb99044187b3af8e96f5984?d=identicon)[curiousteam](/maintainers/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

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

7.3k87.6M278](/packages/barryvdh-laravel-dompdf)[laravel/horizon

Dashboard and code-driven configuration for Laravel queues.

4.2k84.2M225](/packages/laravel-horizon)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)

PHPackages © 2026

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