driftingly/rector-laravel
Rector extension for Laravel that applies automated refactors and upgrade rules based on your composer.json or selected Laravel version sets. Includes rules for core Laravel and first‑party packages like Cashier and Livewire.
LARAVEL_CODE_QUALITY and LARAVEL_TYPE_DECLARATIONS.array_access to method calls or facades to DI in monolithic apps.blank() over empty()).assertSee → assertStringContains).Adopt if:
Look elsewhere if:
rector/rector core)."This tool cuts Laravel upgrade cycles from weeks to hours by automating 90% of breaking-change refactoring. For a $50K/year Laravel app, it saves ~$20K/upgrade in dev time—payback in <3 months. It’s like having a senior Laravel dev on call 24/7, but for the price of a dev’s lunch."
Key Metrics to Track:
LARAVEL_TYPE_DECLARATIONS).*"Rector-Laravel lets us safely adopt new Laravel versions without derailing sprints. Here’s how:
rector process with --dry-run to preview changes.LARAVEL_CODE_QUALITY to enforce modern patterns (e.g., DI over facades).composer make:rule.Example Workflow:
# Upgrade from Laravel 12 → 13
composer require laravel/framework:^13.0
composer require --dev driftingly/rector-laravel
rector process --dry-run --set LaravelLevelSetList::UP_TO_LARAVEL_130
# Review changes, then:
rector process --set LaravelLevelSetList::UP_TO_LARAVEL_130
Why Not Manual PRs?
Controversial but Worth It:
RemoveDumpDataDeadCodeRector cleans up dd() calls—save 500+ lines of noise.Next Steps:
rector.php for team-specific patterns.rector stage to PR checks.Blockers to Address:
abort() → abort_if())."*How can I help you explore Laravel packages today?