Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Rector Downgrade Php Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Minimum PHP version vs. language modernity: Lets the team decide to keep supporting older PHP runtimes (e.g., PHP 7.4/8.0) without forcing engineers to write old-style syntax. You can author with enums, readonly properties, match expressions, union types, first-class callables, etc., then downgrade at build/distribution time.
  • Build vs. buy for compatibility tooling: Provides an off-the-shelf Rector ruleset instead of maintaining an in-house AST transformation pipeline. The decision hinges on how much of your support matrix depends on syntax downgrades versus runtime polyfills.
  • Library/package distribution strategy: Most valuable for libraries, SDKs, and shared internal packages that must run across a wide PHP range. It enables a single modern source tree instead of parallel branches or hand-maintained legacy variants.
  • Roadmap timing for language adoption: Lets product and engineering adopt newer PHP features earlier in the development cycle while postponing the “raise minimum PHP version” customer-facing decision.
  • Legacy/enterprise support commitments: Supports sales or customer-success commitments to old PHP versions without freezing the codebase’s developer experience.
  • CI and release-pipeline investment: Implies a product decision to maintain a build step, generated artifacts, and a PHP-version test matrix. That is a real operational cost, not just a dev-tool choice.

When to Consider This Package

Consider it when:

  • You distribute code—libraries, SDKs, plugins, internal shared packages—to consumers on a wide PHP version range.
  • You cannot raise the minimum PHP version because of customer, hosting, or enterprise constraints, but you want modern syntax and developer ergonomics.
  • You already use Rector or are willing to adopt it, and you can run transformations in CI or at release time.
  • You can test the downgraded output across your supported PHP matrix. The transformation must be validated, not assumed.
  • You are comfortable pinning a small, early-stage package and owning fallback/contribution risk if a transformation is missing or incorrect.

Look elsewhere when:

  • You control the runtime and can simply upgrade PHP. Downgrading adds complexity with little product value.
  • You need API-level backports, not syntax transformation. Use symfony/polyfill-* and similar runtime shims for functions/classes; this package is not a replacement for missing extensions or APIs.
  • You need a mature, widely adopted, high-support dependency. With 44 stars and 0 dependents, this is a niche tool with limited ecosystem validation.
  • You need guaranteed coverage of every new language feature. Downgrade rules are necessarily incomplete and may lag PHP releases; verify the specific features you plan to use.
  • Your team cannot absorb generated-code readability, debugging, or source-map-like traceability concerns.

How to Pitch It (Stakeholders)

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.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
3mdikram/worldmoneywords
snowsoft/config
itmosoft/laravel-subscriptions
larva/laravel-ai-qwen
diephp/sequences
users-au/socialite-provider
twidpay/twid-logger
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib