Skip to content

Engine extension

NextPDF Backport

Automated PHP 8.4 to 8.1 / 7.4 downgrade distribution.

Free · Apache-2.0PHP 8.1–8.3 (PHP81 branch) · PHP 7.4–8.0 (PHP74 branch, core only)

NextPDF Backport is the build infrastructure that produces nextpdf/backport — a PHP 8.1+ (or 7.4+) compatible distribution of the NextPDF ecosystem. It merges source repositories, applies Rector downgrade rules (including 3 custom rules for PHP 8.5/8.4/8.2 features), and outputs Composer packages that replace the native nextpdf/* packages.

How it fits

Built into your workflow

Custom downgrade rules for modern syntax

The build runs Rector downgrade rules over the merged source, including three custom rules that rewrite NextPDF's newer PHP 8.4 syntax: asymmetric visibility, clone-with, and trait constants. Each construct is transformed into an equivalent the older runtime understands, so the distributed package behaves identically on PHP 8.1 and 7.4.

Many source repos, one distribution

The infrastructure pulls Core together with the Artisan tools, the tcpdf-compat layer, and the Laravel, Symfony, and CodeIgniter adapters, then merges them into one unified src tree. That single tree is what gets downgraded and published as nextpdf/backport, so consumers install one coherent package instead of stitching repos together.

Routed to the right PHP target

A version matrix routes each downgrade to its output: a full PHP 8.1 build, and a two-pass PHP 7.4 build that targets the core. The symfony/polyfill-php80 through php84 packages backfill the language features each runtime lacks, and CI runs the whole pipeline automatically when an upstream source release fires a repository_dispatch.

Get started

Install

terminal
composer require nextpdf/backport

In code

How it works

Install the output package

bash
# For PHP 8.1–8.3 users (PHP81 branch output)
composer require nextpdf/backport

# For PHP 7.4–8.0 users (PHP74 branch output, core only)
composer require nextpdf/backport

PHP version to package

bash
# PHP 8.4+   → composer require nextpdf/core      (native)
# PHP 8.1–8.3 → composer require nextpdf/backport  (PHP81 branch)
# PHP 7.4–8.0 → composer require nextpdf/backport  (PHP74 branch, core only)

Capabilities

What you get

  • 3 custom Rector rules — asymmetric visibility, clone-with, trait constants
  • Two-pass Rector — PHP 7.4 target: enum pre-processing then full downgrade
  • Unified merge — Core + Artisan + tcpdf-compat + Laravel + Symfony + CodeIgniter into one src/ tree
  • Pro separation — Pro package built separately as nextpdf/backport-pro (PHP81 branch only)
  • CI/CD pipeline — triggered by a source release via repository_dispatch
  • Polyfill integration — symfony/polyfill-php80 through polyfill-php84 for runtime compatibility

When to use it

Use the backport distribution when your environment is pinned to PHP 8.1–8.3 (full ecosystem) or PHP 7.4–8.0 (core only) and cannot run the native PHP 8.4 packages.