NextPDF backport integration
Build tooling only, not a runtime dependency. Maintainers use this package to produce the PHP (PHP: Hypertext Preprocessor) 7.4 and PHP 8.1 backport distributions of NextPDF. Applications must never add this package as a runtime dependency.
At a glance
Section titled “At a glance”There are two distinct integration points. You integrate the builder repository into the build host release flow. A downstream application integrates only the produced package, nextpdf/backport, into its dependency tree. The builder never enters an application’s dependency tree.
Install (build hosts only)
Section titled “Install (build hosts only)”Because the builder declares "type": "project" in composer.json, treat it as a project repository, not a library. Integrate it by cloning the repository and running a dev install, not with composer require:
git clone https://github.com/nextpdf-labs/backport.gitcd backportgit checkout PHP74composer install --prefer-dist --no-progressCheck out the branch for the target you plan to produce. Use PHP74 (the default) for the PHP 7.4 core-only distribution. Use PHP81 for the PHP 8.1 distribution with all adapters. Do not pass --no-dev. The build requires the Rector engine, PHPStan, and PHPUnit; those are dev dependencies. Verified against composer.json (type, require-dev) and the dual-branch model in /integrations/backport/overview/.
Boot and auto-discovery
Section titled “Boot and auto-discovery”The builder has no framework auto-discovery. At build time, scripts/build.php loads Rector and the three custom abstract syntax tree rules through explicit require_once calls and Composer PHP Standards Recommendation 4 (PSR-4) autoloading. The full boot sequence and source module discovery are documented in /integrations/backport/boot-and-discovery/.
Container bindings
Section titled “Container bindings”Not applicable. The builder is a command-line interface (CLI) tool with no dependency-injection container. Verified against the repository structure and composer.jsonautoload.
Publish configuration
Section titled “Publish configuration”The “publish configuration” is not a separate file. It is the set of build flags and the fixed package definitions in scripts/adjust-composer.php:
- Target map.
--target=php81producesnextpdf/backport(constraint>=8.1 <8.5, replaces core, the adapters, and compat-legacy) and, when included,nextpdf/backport-pro.--target=php74producesnextpdf/backport(constraint>=7.4 <8.1, replaces onlynextpdf/core) and no Pro. - Exclusion.
--no-proexcludes the Pro package on the PHP 8.1 target. By construction, the PHP 7.4 target excludes Pro and all adapters. - Version. The build writes
--version(or the release tag after stripping the leadingv) into the generatedcomposer.jsonandCHANGELOG.md.
This behavior is verified against scripts/build.php and scripts/adjust-composer.php (generatePublicComposer(), generateProComposer(), buildReplace()). The complete flag reference is in /integrations/backport/configuration/.
Release-flow integration
Section titled “Release-flow integration”You integrate the builder into a release flow through the GitHub Actions workflows in .github/workflows/. 0-ci.yml gates every change to each permanent branch with PHPStan, the rule tests, and a dry-run. build.yml produces and releases the distribution when it receives a source-release repository-dispatch event or a manual dispatch. The full operating model — triggers, lanes, validation matrix, and the shared release — is documented in /integrations/backport/production-usage/.
Output-consumption smoke test
Section titled “Output-consumption smoke test”The release pipeline is the integration smoke test. After the build completes, the workflow switches the runner to the target PHP and runs php -l across the emitted source. It then installs and exercises the produced package across the validation matrix (PHP 8.1–8.4 for the PHP 8.1 lane, PHP 7.4 and 8.0 for the PHP 7.4 lane). A distribution that a target runtime rejects does not reach a release. Verified against .github/workflows/build.yml (the syntax-check and validate-* jobs). You can smoke-test locally produced output the same way with the Docker command the validation stage prints — see /integrations/backport/quickstart/.
Public entry points
Section titled “Public entry points”The builder’s public surface is the CLI orchestrator and its Composer script aliases, not a bin/ executable.
| Entry point | Resolves to | Purpose |
|---|---|---|
composer build | php scripts/build.php | Run the full build |
composer build:dry | php scripts/build.php --dry-run | Run a dry-run build |
composer test | phpunit | Run the rule fixture suites |
composer analyse | phpstan analyse rector/rules scripts --level=10 | Analyze the build code |
Verified against composer.jsonscripts. The downstream package exposes the original NextPDF\ application programming interface (API) symbols, unchanged by the backport. The package replaces the source packages and autoloads the merged tree through the single PSR-4 prefix.
See also
Section titled “See also”- /integrations/backport/overview/ — what the builder is and what it produces.
- /integrations/backport/boot-and-discovery/ — boot sequence and source discovery.
- /integrations/backport/install/ — build-host and downstream installation.
- /integrations/backport/production-usage/ — the release pipeline.