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 NextPDF Core together with the NextPDF Artisan tools, the tcpdf-compat layer, and the Laravel, Symfony, and CodeIgniter adapters, then merges them into one unified src tree. That tree is downgraded and published as the single nextpdf/backport package.
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.