PHPackages                             ycchuang99/laravel-pdf-chrome-driver - 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. ycchuang99/laravel-pdf-chrome-driver

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

ycchuang99/laravel-pdf-chrome-driver
====================================

A chrome-php/chrome driver for spatie/laravel-pdf

1.1.1(1mo ago)112↓100%MITPHPPHP ^8.2CI passing

Since Mar 12Pushed 1mo agoCompare

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

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

Chrome PHP Driver for spatie/laravel-pdf
========================================

[](#chrome-php-driver-for-spatielaravel-pdf)

A [chrome-php/chrome](https://github.com/chrome-php/chrome) driver for [spatie/laravel-pdf](https://github.com/spatie/laravel-pdf).

This package provides a PDF generation driver that uses `chrome-php/chrome` (a PHP library for headless Chrome) instead of Browsershot. No Node.js required — pure PHP communication with Chrome via the DevTools Protocol.

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

[](#requirements)

- PHP 8.2+
- Chrome or Chromium binary installed on the system
- `spatie/laravel-pdf` ^2.0

Version Compatibility
---------------------

[](#version-compatibility)

Package VersionPHPspatie/laravel-pdfchrome-php/chrome1.x^8.2^2.0^1.0Installation
------------

[](#installation)

```
composer require ycchuang99/laravel-pdf-chrome-php-driver
```

The service provider is auto-discovered by Laravel.

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

[](#configuration)

Set the driver in your `.env` file:

```
LARAVEL_PDF_DRIVER=chrome-php
```

### Available Configuration Options

[](#available-configuration-options)

Add to your `config/laravel-pdf.php`:

```
'chrome-php' => [
    'chrome_path'               => env('LARAVEL_PDF_CHROME_PATH'),
    'no_sandbox'                => env('LARAVEL_PDF_NO_SANDBOX', false),
    'timeout'                   => env('LARAVEL_PDF_TIMEOUT', 30000),
    'startup_timeout'           => env('LARAVEL_PDF_STARTUP_TIMEOUT', 30),
    'window_size'               => null,
    'custom_flags'              => null,
    'user_data_dir'             => null,
    'env_variables'             => null,
    'ignore_certificate_errors' => env('LARAVEL_PDF_IGNORE_CERT_ERRORS', false),
    'excluded_switches'         => null,
],
```

### Environment Variables

[](#environment-variables)

VariableDescriptionDefault`LARAVEL_PDF_DRIVER`Set to `chrome-php` to use this driver`browsershot``LARAVEL_PDF_CHROME_PATH`Path to Chrome/Chromium binaryAuto-detected`LARAVEL_PDF_NO_SANDBOX`Disable sandbox (required in Docker)`false``LARAVEL_PDF_TIMEOUT`Timeout in milliseconds`30000``LARAVEL_PDF_STARTUP_TIMEOUT`Chrome startup timeout in seconds`30``LARAVEL_PDF_IGNORE_CERT_ERRORS`Ignore SSL certificate errors`false`Usage
-----

[](#usage)

Works exactly like `spatie/laravel-pdf` — just change the driver:

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

// Generate and save a PDF
Pdf::view('invoice', ['order' => $order])
    ->format('a4')
    ->save('/path/to/invoice.pdf');

// With all options
Pdf::html('Hello World')
    ->format('a4')
    ->landscape()
    ->margins(10, 10, 10, 10, 'mm')
    ->headerHtml('Header')
    ->footerHtml('Page ')
    ->scale(0.9)
    ->save('/path/to/output.pdf');

// Use driver per-call (without changing default)
Pdf::view('invoice', $data)
    ->driver('chrome-php')
    ->save('/path/to/invoice.pdf');
```

### Docker / CI Usage

[](#docker--ci-usage)

When running in Docker or CI environments, enable no-sandbox mode and add the recommended Chrome flags:

```
// config/laravel-pdf.php
'chrome-php' => [
    'no_sandbox'     => true,
    'env_variables'  => ['HOME' => '/tmp', 'XDG_CONFIG_HOME' => '/tmp/.config'],
],
```

Or via environment variables (for `no_sandbox` only):

```
LARAVEL_PDF_NO_SANDBOX=true
```

VariableValuePurpose`no_sandbox``true`Disables Chrome's sandbox for compatibility with Docker/CI.`HOME``/tmp`Sets a writable home directory for Chrome in restricted environments.`XDG_CONFIG_HOME``/tmp/.config`Sets a writable config directory to avoid permission errors.Testing
-------

[](#testing)

See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on running the test suite, coverage, and other QA targets.

License
-------

[](#license)

MIT License. See [LICENSE](LICENSE) for details.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance88

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity49

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

4

Last Release

58d ago

PHP version history (2 changes)1.0.0PHP ^8.4

1.1.1PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/138915122?v=4)[Evan](/maintainers/ycchuang99)[@ycchuang99](https://github.com/ycchuang99)

---

Top Contributors

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

---

Tags

laravelpdfdriverchromeheadless-chromechrome-php

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ycchuang99-laravel-pdf-chrome-driver/health.svg)

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

###  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)[lucasromanojf/laravel5-pdf

Provides the HTML2PDF functionality using the wkhtmltopdf library (Laravel 5)

1271.8k](/packages/lucasromanojf-laravel5-pdf)[initred/laravel-tabula

laravel-tabula is a tool for liberating data tables trapped inside PDF files for the Laravel framework.

1418.6k](/packages/initred-laravel-tabula)

PHPackages © 2026

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