dansan/php-backport
Dev tool to backport PHP source code for older runtimes (e.g., PHP 7.2+ features down to PHP 7.0). Configure directories to port, run a script on a *_bp branch, commit/push, then require the backported dev branch in Composer.
Alpha).Beta/Gamma) while supporting older ecosystems (e.g., Alpha), reducing technical debt.*_bp).master vs. master_bp) via automated composer.json updates.php-compat) for individual functions.*_bp) and testing; automate only if CI pipelines can handle parallel branches.Executives:
"This package lets us keep using modern PHP features (e.g., type safety, null coalescing) in our core libraries (Beta/Gamma) while still supporting legacy systems (Alpha) running PHP 7.0. Instead of forcing a costly upgrade of Alpha or rewriting features, we can backport only what’s needed—reducing risk and saving dev time. It’s a low-cost way to maintain feature parity without disrupting production."
Engineering/Tech Leads:
*"The dansan/php-backport package automates the conversion of PHP 7.2+ syntax to PHP 7.0-compatible code using AST parsing (via nikic/php-parser). Here’s how it fits:
master (PHP ≥7.2), then merge to master_bp and run php bin/backport.php to generate 7.0-compatible code.composer.json to point to backported branches (e.g., dev-master_bp@dev)._bp branch; conflicts are resolved by accepting master changes (since backported code is derived).Developers: *"Need to support PHP 7.0 but want to use PHP 7.2+ features? This tool:
src/ and tests/ directories.composer.json to reference backported dependencies._bp branch.
Example:git checkout -b master_bp
php bin/backport.php
composer update
test
git push origin master_bp
It’s like a time machine for PHP—just don’t run it on master!"*
How can I help you explore Laravel packages today?