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

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

tenthfeet/laravel-pdf
=====================

A portable PDF adapter for Laravel supporting multiple drivers.

v1.3.1(3mo ago)020↓50%MITPHPPHP ^8.2

Since Apr 17Pushed 3mo agoCompare

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

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

Laravel PDF Bridge
==================

[](#laravel-pdf-bridge)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d13b5b2d660963c0b471bfda3f0db38657eb0addec9a741941c73cd83dcc966b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f74656e7468666565742f6c61726176656c2d7064662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tenthfeet/laravel-pdf)[![Total Downloads](https://camo.githubusercontent.com/5a14a229dea2625289b9593339873148cc4d321828caaaaf26eb33ada99cb366/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f74656e7468666565742f6c61726176656c2d7064662e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tenthfeet/laravel-pdf)[![PHP Version](https://camo.githubusercontent.com/ce42ccc094ad69407f582b91534813154dc2ba8c653f297a3858e21a5db3d2fe/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d382e322b2d3838393242462e7376673f7374796c653d666c61742d737175617265)](https://php.net)[![Laravel Version](https://camo.githubusercontent.com/7c89e68571fb857c0387fa8cd4ab6964fa81cab9b43d60269f2905593f042bbc/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c61726176656c2d31302532302537432532303131253230253743253230313225323025374325323031332d4646324432302e7376673f7374796c653d666c61742d737175617265)](https://laravel.com)[![License](https://camo.githubusercontent.com/c08a2457e9c3306252c9e1b6e07f078381140ec93e65a5b3bd222d0559ce7312/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f74656e7468666565742f6c61726176656c2d7064662e7376673f7374796c653d666c61742d737175617265)](LICENSE)

A flexible, driver-based PDF generation package for Laravel. This package allows you to decouple your PDF templates from specific libraries (like TCPDF or Dompdf), making your application more maintainable and ready for future engine swaps (e.g., adding Indic font support).

Features
--------

[](#features)

- **Driver-Based Architecture**: Switch between engines (TCPDF, Dompdf, etc.) without changing your template logic.
- **Unified API**: Clean, Laravel-style Facade for generating documents.
- **Template Inheritance**: Simplified base classes for building complex PDF reports.
- **Hook System**: Integrated support for Headers, Footers, and Watermarks via simple interfaces.
- **Fluent API**: Easily stream or download files.

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

[](#requirements)

- **PHP**: `^8.2`
- **Laravel**: `^10.0` | `^11.0` | `^12.0` | `^13.0`

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

[](#installation)

You can install the package via composer:

```
composer require tenthfeet/laravel-pdf
```

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

[](#installation-1)

You can install the package via composer:

```
composer require tenthfeet/laravel-pdf
```

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

[](#configuration)

Publish the configuration file:

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

In `config/pdf.php`, you can set the default driver and configure individual engine settings:

```
return [
    'default' => env('PDF_DRIVER', 'tcpdf'),

    'drivers' => [
        'tcpdf' => [
            'class' => \Tenthfeet\Pdf\Adapters\TcpdfAdapter::class,
        ],
        // ...
    ],
];
```

Usage
-----

[](#usage)

### 1. Create a Template

[](#1-create-a-template)

Extend the `PdfDocument` class and implement the `body` method.

```
namespace App\Pdf\Templates;

use Tenthfeet\Pdf\PdfDocument;
use Tenthfeet\Pdf\Contracts\PdfAdapter;

class MyReport extends PdfDocument
{
    public function body(PdfAdapter $pdf): void
    {
        $pdf->writeHTML("This is the document body.");
    }
}
```

### 2. Hooks &amp; Interfaces

[](#2-hooks--interfaces)

You can add headers, footers, or watermarks to your templates by implementing the corresponding interfaces.

#### Headers &amp; Footers

[](#headers--footers)

Implement `HasHeader` or `HasFooter` to inject content into every page.

```
use Tenthfeet\Pdf\Contracts\HasHeader;
use Tenthfeet\Pdf\Contracts\HasFooter;

class MyReport extends PdfDocument implements HasHeader, HasFooter
{
    public function header(PdfAdapter $pdf): void
    {
        $pdf->writeHTML("Page Header");
    }

    public function footer(PdfAdapter $pdf): void
    {
        $pdf->SetY(-15);
        $pdf->writeHTML("Page Footnote");
    }

    public function body(PdfAdapter $pdf): void
    {
        // ...
    }
}
```

#### Watermarks

[](#watermarks)

Implement `HasWatermark` to add a background watermark.

```
use Tenthfeet\Pdf\Contracts\HasWatermark;

class MyReport extends PdfDocument implements HasWatermark
{
    public function watermark(PdfAdapter $pdf, string $text = 'DRAFT'): void
    {
        // You can use the built-in helper from the base class
        parent::watermark($pdf, $text);
    }
}
```

### 3. Generate the PDF

[](#3-generate-the-pdf)

Using the `Pdf` facade:

```
use Tenthfeet\Pdf\Facades\Pdf;
use App\Pdf\Templates\InvoiceReport;

public function download(Request $request)
{
    $document = new InvoiceReport($request->all());

    return Pdf::make($document)->download('invoice.pdf');
}
```

### 3. Swapping Drivers

[](#3-swapping-drivers)

You can override the driver globally in your `.env` or per-template by adding a `$driver` property:

```
class SpecialReport extends PdfDocument
{
    public ?string $driver = 'dompdf'; // Force this template to use Dompdf
}
```

License
-------

[](#license)

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

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance82

Actively maintained with recent releases

Popularity7

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

Total

5

Last Release

95d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/af032b274982990a0429c5d5f74ba2dd3a18b0f6e7c95b6c4666237a5599e7e4?d=identicon)[Tenthfeet](/maintainers/Tenthfeet)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

45444.2k1](/packages/pressbooks-pressbooks)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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