Download the PHP package zentiq-labs/fast-pdf without Composer

On this page you can find all versions of the php package zentiq-labs/fast-pdf. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package fast-pdf

# Fast PDF

High-performance, sub-second, pixel-perfect HTML-to-PDF rendering for PHP applications powered by direct headless Chromium IPC pipes. Zero Node.js, NPM, or Puppeteer required. Zero framework lock-in.

Official Package: Maintained by Zentiq Labs.
For security disclosures and support, visit zentiqlabs.com.

Tests Latest Version on Packagist Total Downloads License

Table of Contents

Why Fast PDF?

Most PHP PDF solutions fall into one of two traps: they ship a bundled renderer with incomplete CSS support, or they delegate to a Node.js + Puppeteer stack — adding hundreds of megabytes and an IPC overhead tax to every request.

Fast PDF takes a third path. It speaks directly to the system's headless Chromium binary through native OS process pipes. Your HTML is rendered by the full Blink engine and the binary PDF stream is returned — no Node.js runtime, no browser automation framework, no intermediate file conversion.

Approach CSS Fidelity Node.js Framework Required
DOMPDF / mPDF Partial (CSS 2.1) No No
Puppeteer / Playwright Full Yes No
wkhtmltopdf Partial (WebKit 2014) No No
Fast PDF Full (Blink engine) No No

Requirements

Requirement Version
PHP ^8.3
Chromium / Google Chrome Any headless-capable build

Chromium must be installed on the host. The package probes common system paths automatically and raises BinaryNotFoundException with actionable instructions if it cannot locate a binary.

  • Alpine Linux: apk add chromium
  • Debian / Ubuntu: apt-get install chromium-browser
  • macOS (Homebrew): brew install --cask chromium

Installation

Quick Start

Configuration

Pass any subset of the configuration array to the constructor. Unset keys fall back to environment variables, then to built-in defaults.

Alternatively, publish and require the bundled config file:

Environment variables

Variable Default Description
FAST_PDF_BINARY (auto-discovered) Absolute path to the Chromium binary
FAST_PDF_TIMEOUT 30 Max seconds before PdfGenerationFailedException
FAST_PDF_PAPER_SIZE a4 Default paper size
FAST_PDF_ORIENTATION portrait Default orientation
FAST_PDF_MEDIA print CSS media type to emulate
FAST_PDF_TAILWIND_CDN https://cdn.tailwindcss.com Tailwind standalone CDN URL
FAST_PDF_TEMP_DIR sys_get_temp_dir() Scratch directory

Fluent Builder API

All methods return $this and can be chained in any order.

Method Description
fromHtml(string $html) Set a raw HTML string as the source
fromFile(string $path, array $data = []) Render a PHP template file as the source
paper(string $format = 'a4', string $orientation = 'portrait') Set paper format and orientation in one call
paperSize(PaperSize\|string $size) Set paper size (see enum values)
landscape() Landscape orientation
portrait() Portrait orientation
margins(float $t, float $r, float $b, float $l, string $unit = 'mm') Override margins. Unit: mm, cm, in, px
withTailwind() Inject standalone Tailwind CDN before rendering
emulateMedia(string $media = 'print') CSS media type: 'print' or 'screen'
output(): string Render and return raw binary PDF bytes
save(string $path) Render and write to a file path
toInlineResponse(?string $filename = null): PdfResponse Return a PdfResponse for inline browser display (no exit)
toDownloadResponse(?string $filename = null): PdfResponse Return a PdfResponse for file download (no exit)
download(string $filename = 'document.pdf') Emit download headers, stream, and exit
stream(string $filename = 'document.pdf') Emit inline headers, stream, and exit

PHP Template Files

fromFile() works exactly like a simple view engine: variables in $data are extracted into the template scope, and the output buffer contents become the HTML source.

Tailwind CSS Support

Chain ->withTailwind() to inject the standalone Tailwind CDN script into the <head> before Chromium renders the page. No build pipeline required.

For offline environments or strict CSP policies, override tailwind_cdn_url to a self-hosted build of the Tailwind standalone CLI output.

Output Methods

Raw binary string

Save to disk

Browser download

Inline browser render

Paper Sizes & Orientation

Available PaperSize enum cases (accepts the lowercase string or the enum value):

A0 A1 A2 A3 A4 A5 A6 Letter Legal Tabloid Ledger

Framework Integration

Core PHP

CodeIgniter 4

Register a singleton in app/Config/Services.php:

Use it in a controller:

Symfony

Register as a service in config/services.yaml:

Inject into a controller or service via constructor injection:

Laravel

The package is framework-agnostic but integrates cleanly with Laravel via manual binding in a service provider:

Then inject FastPdf anywhere the service container resolves it.

WordPress

Paper Setup

The paper() method is a convenience shorthand for setting both the paper format and orientation in one call.

Supported formats: a0 a1 a2 a3 a4 a5 a6 letter legal tabloid ledger.

The individual paperSize(), landscape(), and portrait() methods remain available for finer-grained control.

Response Helpers

toInlineResponse() and toDownloadResponse() render the PDF and return a PdfResponse value object instead of calling exit. This fits naturally into any framework that manages its own response lifecycle.

PdfResponse exposes:

For Symfony or any PSR-7 framework:

Testing with FastPdf::fake()

Call FastPdf::fake() to get an instance that records every render call without spawning Chromium.

The fake returns %PDF-1.4 fake bytes by default. This is intentional — unit tests should not depend on real PDF content. To override the fake output, reach into the engine:

Docker & Alpine Linux

A ready-to-use test image is included in docker/Dockerfile.test. It runs the full Pest suite against a real Chromium binary inside an Alpine container.

Minimal additions for your own application Dockerfile:

Always include --no-sandbox and --disable-setuid-sandbox in chromium_flags (the package defaults already include them) when running inside unprivileged Docker containers.

Manual Test Script

A standalone smoke-test script is included at bin/test-render.php. It generates a Tailwind-styled invoice PDF to output.pdf in the current working directory.

Testing

With coverage:

Static analysis (PHPStan level 9):

Code style (PSR-12):

Contributing

Contributions, issues, and feature requests are welcome. Please ensure any pull request:

  1. Targets the develop branch.
  2. Ships with corresponding test coverage for all new behaviour.
  3. Passes the full CI pipeline (test, check, cs) locally before opening a PR.
  4. Follows Conventional Commits.

License

The MIT License (MIT). See LICENSE for details.

Developed and maintained by Usman Khan at Zentiq Labs.


All versions of fast-pdf with dependencies

PHP Build Version
Package Version
Requires php Version ^8.3
symfony/process Version ^7.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package zentiq-labs/fast-pdf contains the following files

Loading the files please wait ...