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

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

snapapi/laravel-pdf
===================

SnapAPI driver for spatie/laravel-pdf — generate PDFs via the SnapAPI cloud API, no Chrome to manage

v1.0.0(2mo ago)00MITPHPPHP ^8.1

Since Feb 25Pushed 2mo agoCompare

[ Source](https://github.com/Sleywill/snapapi-laravel-pdf)[ Packagist](https://packagist.org/packages/snapapi/laravel-pdf)[ RSS](/packages/snapapi-laravel-pdf/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (5)Versions (2)Used By (0)

SnapAPI Driver for Laravel PDF
==============================

[](#snapapi-driver-for-laravel-pdf)

[![Latest Version on Packagist](https://camo.githubusercontent.com/04ce67d1064161a987d60f8b715aa158ee6f0370db5b723c791df46d6e6a8e85/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736e61706170692f6c61726176656c2d7064662e737667)](https://packagist.org/packages/snapapi/laravel-pdf)[![License](https://camo.githubusercontent.com/ef0eae070c4c7eaee8525561b11889ee52606b55fef0a1385aaf030d2397535e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f736e61706170692f6c61726176656c2d7064662e737667)](LICENSE)

A [spatie/laravel-pdf](https://github.com/spatie/laravel-pdf) v2 driver that generates PDFs via [SnapAPI](https://snapapi.pics) — a managed screenshot and PDF API powered by Chromium. No Chrome to install, no Lambda setup, no Docker layer headaches.

```
Pdf::view('invoices.receipt', ['invoice' => $invoice])
    ->format('A4')
    ->driver(SnapApiDriver::class)
    ->save(storage_path('invoices/receipt.pdf'));
```

---

Why use this?
-------------

[](#why-use-this)

- ✅ **No Chromium to manage** — no binary updates, no memory limits to tune
- ✅ **Works everywhere** — local, shared hosting, serverless, Docker
- ✅ **Full CSS support** — Flexbox, Grid, Tailwind, web fonts, all rendered by a real Chromium
- ✅ **Free tier** — 200 PDFs/month, no credit card

---

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

[](#requirements)

- PHP 8.1+
- Laravel 10, 11, or 12
- [spatie/laravel-pdf](https://github.com/spatie/laravel-pdf) v2
- A free [SnapAPI key](https://snapapi.pics)

---

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

[](#installation)

```
composer require snapapi/laravel-pdf
```

Publish the config file:

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

---

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

[](#configuration)

Add your API key to `.env`:

```
SNAPAPI_KEY=sk_live_your_key_here
```

Get a free key at [snapapi.pics](https://snapapi.pics) — free tier includes 200 PDFs/month.

---

Usage
-----

[](#usage)

### Basic PDF from Blade view

[](#basic-pdf-from-blade-view)

```
use Spatie\LaravelPdf\Facades\Pdf;
use SnapApi\LaravelPdf\SnapApiDriver;

Pdf::view('pdfs.invoice', ['invoice' => $invoice])
    ->driver(SnapApiDriver::class)
    ->save(storage_path('pdfs/invoice.pdf'));
```

### Respond with PDF download

[](#respond-with-pdf-download)

```
return Pdf::view('pdfs.invoice', ['invoice' => $invoice])
    ->driver(SnapApiDriver::class)
    ->format('A4')
    ->download('invoice.pdf');
```

### Respond inline (open in browser)

[](#respond-inline-open-in-browser)

```
return Pdf::view('pdfs.report', $data)
    ->driver(SnapApiDriver::class)
    ->inline('report.pdf');
```

### Set format and margins

[](#set-format-and-margins)

```
Pdf::view('pdfs.letter', $data)
    ->driver(SnapApiDriver::class)
    ->format('Letter')
    ->margins(top: 15, right: 10, bottom: 15, left: 10)
    ->landscape()
    ->save('/path/to/output.pdf');
```

### From raw HTML

[](#from-raw-html)

```
Pdf::html('Hello WorldGenerated by SnapAPI.')
    ->driver(SnapApiDriver::class)
    ->save('/path/to/output.pdf');
```

### Set as default driver

[](#set-as-default-driver)

In `config/pdf.php` (published from spatie/laravel-pdf):

```
'default_driver' => \SnapApi\LaravelPdf\SnapApiDriver::class,
```

Then you can omit `->driver()` entirely:

```
Pdf::view('pdfs.invoice', $data)->save('invoice.pdf');
```

---

Configuration reference
-----------------------

[](#configuration-reference)

`config/snapapi-pdf.php`:

```
return [
    'api_key'  => env('SNAPAPI_KEY', ''),
    'base_url' => env('SNAPAPI_BASE_URL', 'https://api.snapapi.pics'),
    'timeout'  => env('SNAPAPI_TIMEOUT', 60),
];
```

KeyDefaultDescriptionapi\_key—Your SnapAPI key (required)base\_urlAPI base URLtimeout60HTTP timeout in seconds---

Testing
-------

[](#testing)

```
composer test
```

---

Changelog
---------

[](#changelog)

### 1.0.0

[](#100)

- Initial release
- Supports `generatePdf` and `savePdf` (full spatie/laravel-pdf v2 driver interface)
- Paper format, margins, orientation, custom width/height
- Header and footer HTML support

---

License
-------

[](#license)

MIT — see [LICENSE](LICENSE)

---

Links
-----

[](#links)

- 🔑 [Get a free SnapAPI key](https://snapapi.pics)
- 📖 [SnapAPI docs](https://snapapi.pics/docs)
- 📦 [spatie/laravel-pdf](https://github.com/spatie/laravel-pdf)

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance84

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

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

Unknown

Total

1

Last Release

82d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

laravelpdfscreenshotchromiumhtml-to-pdfSnapAPI

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[barryvdh/laravel-dompdf

A DOMPDF Wrapper for Laravel

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

Snappy PDF/Image for Laravel

2.8k24.8M48](/packages/barryvdh-laravel-snappy)[chrome-php/chrome

Instrument headless chrome/chromium instances from PHP

2.6k4.5M64](/packages/chrome-php-chrome)[elibyy/tcpdf-laravel

tcpdf support for Laravel 6, 7, 8, 9, 10, 11

3542.7M5](/packages/elibyy-tcpdf-laravel)[tarfin-labs/easy-pdf

Makes pdf processing easy.

1718.3k](/packages/tarfin-labs-easy-pdf)[wemersonjanuario/laravelpdf

Another HTML to PDF Converter for Laravel

2912.9k1](/packages/wemersonjanuario-laravelpdf)

PHPackages © 2026

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