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

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

sglms/pdf
=========

Simple Laravel wrapper for mPDF with fluent view rendering and signing helpers.

0.4(2mo ago)1213MITPHPPHP &gt;=8.3

Since Aug 8Pushed 1mo agoCompare

[ Source](https://github.com/SGLMS/pdf)[ Packagist](https://packagist.org/packages/sglms/pdf)[ Docs](https://sglms.com)[ RSS](/packages/sglms-pdf/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (6)Versions (6)Used By (0)

SGLMS PDF
=========

[](#sglms-pdf)

Simple Laravel wrapper around mPDF with a fluent API for rendering Blade views, attaching headers/footers, and signing documents.

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

[](#requirements)

- PHP &gt;= 8.3
- Laravel 12
- mPDF 8.2+

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

[](#installation)

```
composer require sglms/pdf
```

Laravel package discovery registers the service provider and facade automatically.

Quick Start
-----------

[](#quick-start)

```
use Sglms\Pdf\Facades\Pdf;

Pdf::view('pdf.invoice', ['order' => $order])->output('invoice.pdf');
```

Usage
-----

[](#usage)

### Initialize with configuration

[](#initialize-with-configuration)

```
use Sglms\Pdf\Facades\Pdf;

$pdf = Pdf::init(
	config: ['format' => 'Letter'],
	stylesheet: 'css/pdf.css',
	header: 'pdf.header',
	footer: 'pdf.footer'
);
```

### Render one or multiple views

[](#render-one-or-multiple-views)

```
$pdf->view('pdf.page-one', ['name' => 'Jane'])
	->view('pdf.page-two')
	->output('document.pdf');
```

### Add logo for header/footer views

[](#add-logo-for-headerfooter-views)

The logo is available in mPDF templates as `var:logo`.

```
$pdf->logo('images/logo.svg');
```

If your header or footer uses the logo, call `logo()` before `header()` / `footer()`.

### Add signature block

[](#add-signature-block)

```
$pdf->sign(
	signature: 'pdf.signature',
	data: ['name' => 'John Doe'],
	x: 50,
	y: 100,
	width: 100
);
```

### Sign existing PDF

[](#sign-existing-pdf)

```
$pdf->signFile('pdf.signature', storage_path('app/base.pdf'));
```

### Output options

[](#output-options)

```
// Raw string — pass to Laravel's response() helper
$raw = $pdf->output('document.pdf');
$raw = $pdf->string();                   // alias, no filename context

// Write to an absolute file path
$pdf->save(storage_path('app/a.pdf'));

// Laravel Storage disk
$pdf->storeAs('a.pdf', 'public');

// Stream directly to the browser (bypasses Laravel response)
$pdf->inline('document.pdf');            // Content-Disposition: inline
$pdf->download('document.pdf');          // Content-Disposition: attachment
```

### Access underlying mPDF instance

[](#access-underlying-mpdf-instance)

```
$mpdf = $pdf->get();
```

Controller Example
------------------

[](#controller-example)

```
use App\Http\Controllers\Controller;
use Sglms\Pdf\Facades\Pdf;

class CustomController extends Controller
{
	public function render()
	{
		$bytes = Pdf::view('pdf.filename')
			->sign('pdf.signature')
			->output('document.pdf');

		return response($bytes, 200)
			->header('Content-Type', 'application/pdf')
			->header('Content-Disposition', 'inline; filename="document.pdf"');
	}
}
```

Notes
-----

[](#notes)

- mPDF applies headers/footers from the point they are set. Set header/footer before the first rendered body view when possible.
- This package is intentionally lightweight and optimized for straightforward document-generation workflows.

License
-------

[](#license)

MIT

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance90

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity45

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

Total

4

Last Release

64d ago

PHP version history (2 changes)0.1PHP &gt;=8.2

0.2PHP &gt;=8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13224306?v=4)[James](/maintainers/jaimercz)[@jaimercz](https://github.com/jaimercz)

---

Top Contributors

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

---

Tags

laravellaravel-packagempdfpdf-generationpdf-wrapperlaravelpdfsignaturempdfsglms

### Embed Badge

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

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

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

Laravel administration panel

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

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

725172.4k14](/packages/tallstackui-tallstackui)[hasinhayder/tyro-dashboard

Tyro Dashboard - Beautiful admin dashboard for managing Tyro roles, privileges, users, and settings

5443.8k](/packages/hasinhayder-tyro-dashboard)

PHPackages © 2026

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