Weave Code
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 Laravel Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Major Laravel Version Upgrades: Automate migration from Laravel 10 → 11 → 12 → 13+ by applying version-specific rule sets (e.g., UP_TO_LARAVEL_130), reducing manual refactoring effort by 70-80%.
  • Code Quality Initiatives: Enforce modern Laravel patterns (e.g., LARAVEL_CODE_QUALITY, LARAVEL_COLLECTION) to align with team standards, improving maintainability and IDE support (e.g., type hints, dependency injection).
  • Technical Debt Reduction: Targeted refactoring of legacy patterns (e.g., LARAVEL_LEGACY_FACTORIES_TO_CLASSES, LARAVEL_ARRAYACCESS_TO_METHOD_CALL) to future-proof codebases.
  • Testing Modernization: Update deprecated testing methods (LARAVEL_TESTING) to leverage Laravel’s latest assertions and mocking capabilities.
  • Build vs. Buy: Buy for Laravel-specific upgrades (vs. custom scripts or manual PRs). Justify as a one-time cost for long-term savings in upgrade cycles.
  • Use Cases:
    • Pre-upgrade codebase audits to identify breaking changes.
    • Post-upgrade cleanup to adopt new Laravel idioms (e.g., facades → DI, dd() removal).
    • Onboarding new devs by standardizing codebase patterns.

When to Consider This Package

  • Adopt if:

    • Your team uses Laravel 8+ and plans upgrades to Laravel 10+.
    • You have >50K LoC or multiple legacy patterns (e.g., array access, helper functions, magic methods).
    • Your CI/CD pipeline can handle dry runs (test changes before merging).
    • You prioritize developer velocity over incremental manual fixes.
  • Look elsewhere if:

    • Your codebase is <10K LoC or trivial to upgrade manually.
    • You lack PHP 8.1+ (Rector’s minimum requirement).
    • Your team resists automated refactoring (requires buy-in for rule sets).
    • You need custom business logic transformations (extend Rector or use a custom script).

How to Pitch It (Stakeholders)

For Executives:

*"This tool automates Laravel upgrades—saving 3–6 months of dev time per major version (e.g., 10→13). For example:

  • Laravel 11’s Str::of() migration: 200+ files updated in minutes vs. weeks manually.
  • Code quality: Standardizes patterns (e.g., facades → DI) to reduce tech debt by 40%.
  • ROI: Justify as a one-time $X cost (dev hours) with multi-year savings in upgrade cycles. Used by TomasVotruba (PHPStan creator) and Laravel’s core team—proven at scale."

For Engineering:

*"Rector/Laravel lets us:

  1. Upgrade safely: Auto-detects Laravel version in composer.json and applies version-specific rules (e.g., UP_TO_LARAVEL_130).
  2. Enforce standards: Convert dd() to Log::debug(), abort_if() helpers, or JsonResponseconsistently across 100+ PRs.
  3. Reduce risk: Run in dry mode first (--dry-run) to preview changes.
  4. Extend it: Add custom rules for your team’s patterns (e.g., composer make:rule). Example: Migrating Route::get('users', 'UserController@index') to [UserController::class, 'index'] in one command.*

Trade-offs:

  • Learning curve: Requires understanding Rector’s rule sets (but docs are comprehensive).
  • CI integration: Add a rector step to your pipeline (like PHPStan). Alternatives: Manual PRs (slow) or custom scripts (fragile)."*
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.
croct/coding-standard
croct/plug-php
nqxcode/phpmorphy
boundwize/pyrameter
testo/facade
develia/commons
dmstr/symfony-system-resources-bundle
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
renatomarinho/laravel-page-speed
develia/geo-bundle
austinheap/laravel-database-encryption
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
imbo/imbo-coding-standard
visualbuilder/filament-lottie
servicioslineaonce/starter-kit
atomcoder/laravel-reorderable
irajul/filament-shadcn-theme