rector/rector-downgrade-php
rector/rector-downgrade-php provides Rector rules for downgrading PHP code, automatically rewriting modern syntax and features into older, compatible versions. Useful for backporting projects or libraries to legacy PHP runtimes with repeatable transformations.
Consider it when:
Look elsewhere when:
symfony/polyfill-* and similar runtime shims for functions/classes; this package is not a replacement for missing extensions or APIs.For executives: This is a small, low-cost enabler for a bigger product decision: keeping older-PHP customers supported while letting engineering write modern PHP. It can reduce duplicated legacy branches and delay forced upgrades without delaying language adoption. The caveat is maturity—this package is early-stage, so treat it as a validated build-time tool, not a foundation dependency. Approve a time-boxed pilot with a test matrix before committing customer-facing support policy to it.
For engineering: rector/rector-downgrade-php is a Rector ruleset that transforms modern PHP syntax into older-compatible equivalents. It fits naturally into a release pipeline: write modern source, run Rector with the downgrade set, test the generated output on the oldest supported PHP, and ship that artifact. It does not replace polyfills, and it will not cover every feature or edge case. Pin the version, add golden tests across the PHP matrix, and be prepared to contribute rules or fall back to conditional code where transformation is unsafe.
How can I help you explore Laravel packages today?