rector/rector-laravel
Community Rector extension to automate Laravel upgrades. Adds Laravel and first-party package rules (e.g., Cashier, Livewire), with version-based set providers that detect your composer.json or manual level sets to apply the right refactors for your target Laravel version.
UP_TO_LARAVEL_130), reducing manual refactoring effort by 70-80%.LARAVEL_CODE_QUALITY, LARAVEL_COLLECTION) to align with team standards, improving maintainability and IDE support (e.g., type hints, dependency injection).LARAVEL_LEGACY_FACTORIES_TO_CLASSES, LARAVEL_ARRAYACCESS_TO_METHOD_CALL) to future-proof codebases.LARAVEL_TESTING) to leverage Laravel’s latest assertions and mocking capabilities.dd() removal).Adopt if:
Look elsewhere if:
*"This tool automates Laravel upgrades—saving 3–6 months of dev time per major version (e.g., 10→13). For example:
Str::of() migration: 200+ files updated in minutes vs. weeks manually.*"Rector/Laravel lets us:
composer.json and applies version-specific rules (e.g., UP_TO_LARAVEL_130).dd() to Log::debug(), abort_if() helpers, or JsonResponse—consistently across 100+ PRs.--dry-run) to preview changes.composer make:rule).
Example: Migrating Route::get('users', 'UserController@index') to [UserController::class, 'index'] in one command.*Trade-offs:
rector step to your pipeline (like PHPStan).
Alternatives: Manual PRs (slow) or custom scripts (fragile)."*How can I help you explore Laravel packages today?