PHPackages                             dskripchenko/laravel-php-pdf - 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. dskripchenko/laravel-php-pdf

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

dskripchenko/laravel-php-pdf
============================

Laravel bridge for dskripchenko/php-pdf — the MIT PDF toolkit. Pdf facade, config-driven fonts and page setup, and a response()-&gt;pdf() macro. GPL-free alternative to mpdf/FPDI stacks.

v1.1.1(1mo ago)1436MITPHPPHP ^8.2CI passing

Since Jul 17Pushed 3w agoCompare

[ Source](https://github.com/dskripchenko/laravel-php-pdf)[ Packagist](https://packagist.org/packages/dskripchenko/laravel-php-pdf)[ Docs](https://github.com/dskripchenko/laravel-php-pdf)[ RSS](/packages/dskripchenko-laravel-php-pdf/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

dskripchenko/laravel-php-pdf
============================

[](#dskripchenkolaravel-php-pdf)

> Laravel bridge for [`dskripchenko/php-pdf`](https://github.com/dskripchenko/php-pdf) — the pure-PHP, **MIT-licensed** PDF toolkit (generate, read, merge). No GPL friction, [faster than mpdf/dompdf](https://github.com/dskripchenko/php-pdf/blob/main/docs/en/BENCHMARKS.md), and [conformance-validated on every push](https://github.com/dskripchenko/php-pdf/blob/main/docs/en/CONFORMANCE.md).

> 🌐 **English** · [Deutsch](docs/de/README.md) · [Русский](docs/ru/README.md) · [中文](docs/zh/README.md)

[![Tests](https://camo.githubusercontent.com/3419181fb708d70859ecf2a0235fb7cc1b616d22df89db37abca85d0c82b412e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f64736b7269706368656e6b6f2f6c61726176656c2d7068702d7064662f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473266c6f676f3d676974687562)](https://github.com/dskripchenko/laravel-php-pdf/actions/workflows/tests.yml)[![Latest Version](https://camo.githubusercontent.com/e06bcd39ef06c0f552d511578688fabdce361ec781928375c131dde0e66731d1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f64736b7269706368656e6b6f2f6c61726176656c2d7068702d7064663f6c6f676f3d7061636b6167697374266c6f676f436f6c6f723d7768697465)](https://packagist.org/packages/dskripchenko/laravel-php-pdf)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)[![PHP](https://camo.githubusercontent.com/789befc8d88593153c7b6252f5256360c9532b26eb84fcb39b1ab842cc239e9d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e322532422d707572706c652e737667)](https://www.php.net)[![Laravel](https://camo.githubusercontent.com/977ed8891f0c3f376e098db6a13fd1aa413d5d0c4e380d9a550a475e52696470/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d3131253230253743253230313225323025374325323031332d7265642e737667)](https://laravel.com)

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

[](#installation)

```
composer require dskripchenko/laravel-php-pdf
```

The service provider and the `Pdf` facade register automatically (package discovery). Optionally publish the config:

```
php artisan vendor:publish --tag=php-pdf-config
```

Usage
-----

[](#usage)

### HTML → PDF

[](#html--pdf)

```
use Dskripchenko\LaravelPhpPdf\Facades\Pdf;

// bytes
$bytes = Pdf::fromHtml('Invoice #1234')->bytes();

// file
Pdf::fromHtml(view('invoices.show', $data)->render())->save(storage_path('invoice.pdf'));

// HTTP responses
Route::get('/invoice', fn () => Pdf::fromHtml($html)->inline('invoice.pdf'));
Route::get('/invoice/download', fn () => Pdf::fromHtml($html)->download('invoice.pdf'));

// Streamed responses — rendered straight into the output buffer, never
// held in memory as one string. For very large documents.
Route::get('/report', fn () => Pdf::fromHtml($html)->stream('report.pdf'));
Route::get('/report/download', fn () => Pdf::fromHtml($html)->streamDownload('report.pdf'));
```

### `response()->pdf()`

[](#response-pdf)

The macro accepts a `PendingPdf`, a php-pdf `Document` (either layer), or raw bytes — the mpdf `Output('', 'D')` habit, the Laravel way:

```
return response()->pdf(Pdf::fromHtml($html), 'invoice.pdf');               // inline
return response()->pdf(Pdf::fromHtml($html), 'invoice.pdf', inline: false); // download
```

### Programmatic documents

[](#programmatic-documents)

```
$document = Pdf::builder()
    ->heading(1, 'Quarterly report')
    ->paragraph('Q1 revenue exceeded the forecast by 12%.')
    ->build();

return Pdf::render($document)->download('report.pdf');
```

Everything from the underlying toolkit is reachable — charts, barcodes, AcroForm fields, PDF/A, encryption, PKCS#7 signing, and reading/merging existing PDFs. See the [php-pdf documentation](https://github.com/dskripchenko/php-pdf#documentation).

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

[](#configuration)

`config/php-pdf.php` controls page defaults and fonts:

```
'paper' => 'a4',              // a3..a6, letter, legal, tabloid, executive
'orientation' => 'portrait',
'margins' => ['top' => null, 'right' => null, 'bottom' => null, 'left' => null], // pt

'fonts' => [
    // Embedded TTFs (required for Cyrillic, Greek, Arabic, CJK — the
    // base-14 defaults cover Latin only). Fonts are subset automatically.
    'default' => storage_path('fonts/DejaVuSans.ttf'),
    'bold' => storage_path('fonts/DejaVuSans-Bold.ttf'),
    // Named families for CSS font-family / RunStyle(fontFamily: ...):
    'families' => [
        'mono' => ['regular' => storage_path('fonts/DejaVuSansMono.ttf')],
    ],
],

'metadata' => ['Author' => 'ACME Corp.'],  // default /Info entries
```

Migrating from laravel-mpdf / barryvdh wrappers
-----------------------------------------------

[](#migrating-from-laravel-mpdf--barryvdh-wrappers)

The underlying toolkit ships compat facades and guides for [mpdf](https://github.com/dskripchenko/php-pdf/blob/main/docs/en/MIGRATION-FROM-MPDF.md)and [FPDI](https://github.com/dskripchenko/php-pdf/blob/main/docs/en/MIGRATION-FROM-FPDI.md)call sites.

Requirements
------------

[](#requirements)

- PHP 8.2+
- Laravel 11, 12, or 13
- Extensions: `mbstring`, `zlib`, `dom` (plus `openssl` for encryption/signing)

Testing
-------

[](#testing)

```
composer test
```

License
-------

[](#license)

MIT. The underlying `dskripchenko/php-pdf` is MIT as well — no GPL obligations anywhere in the stack.

###  Health Score

45

—

FairBetter than 91% of packages

Maintenance94

Actively maintained with recent releases

Popularity20

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

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 ~5 days

Total

3

Last Release

34d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3aae29ece4986be5d3eea1ba57457547d2ce92fcdee466af45f69ec4079ec9c7?d=identicon)[dskripchenko](/maintainers/dskripchenko)

---

Top Contributors

[![dskripchenko](https://avatars.githubusercontent.com/u/5102028?v=4)](https://github.com/dskripchenko "dskripchenko (6 commits)")

---

Tags

dompdf-alternativefpdihtml-to-pdflaravellaravel-packagelaravel-pdfmit-licensempdf-alternativepdfpdf-generationpdf-mergerphplaravelpdfpdf mergehtml-to-pdfpdf-generationmpdf-alternativemitfpdi-alternative

### Embed Badge

![Health badge](/badges/dskripchenko-laravel-php-pdf/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3365.5M359](/packages/psalm-plugin-laravel)[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k118.2M1.0k](/packages/laravel-socialite)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

80732.6M276](/packages/laravel-mcp)[defstudio/telegraph

A laravel facade to interact with Telegram Bots

818355.4k3](/packages/defstudio-telegraph)[api-platform/laravel

API Platform support for Laravel

58190.1k22](/packages/api-platform-laravel)[forjedio/inertia-table

Backend-driven dynamic tables for Laravel + Inertia.js

272.5k](/packages/forjedio-inertia-table)

PHPackages © 2026

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