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

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.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Major Laravel Version Upgrades: Automates migration of codebases from Laravel 10 → 11 → 12 → 13+, reducing manual refactoring effort by 80%+ for breaking changes (e.g., Facade deprecations, Eloquent magic methods, Container string binding).
  • Code Quality Initiatives: Enables "modernization sprints" by applying opinionated improvements (e.g., empty()blank(), Facades → DI, dd() removal) via LARAVEL_CODE_QUALITY set.
  • Tech Debt Reduction: Targets legacy patterns (e.g., legacy factories, abort()abort_if()) to align with current Laravel best practices without full rewrite.
  • Build vs. Buy: Buy for Laravel-specific refactoring (vs. generic Rector or custom scripts). Justifies investment when:
    • Upgrading 3+ Laravel versions at once.
    • Maintaining large codebases (>50K LoC) with deep Laravel integration.
    • Prioritizing developer velocity over incremental manual fixes.
  • Use Cases:
    • Migration Projects: Laravel 8→13 upgrades (e.g., array_access_data()Arr::get()).
    • Legacy Modernization: Converting static Facades to DI in monolithic apps.
    • Onboarding: Standardizing new devs on modern Laravel patterns (e.g., where()whereLike()).
    • CI/CD Pipelines: Automated pre-merge checks for Laravel version compatibility.

When to Consider This Package

Adopt when:

  • Your team is upgrading Laravel 10+ and faces breaking changes (e.g., Facades, Eloquent, Container).
  • You need automated refactoring for >100 files to avoid manual drudgery.
  • Code quality is a priority (e.g., adding type hints, removing debug code).
  • You’re maintaining large-scale apps (e.g., SaaS platforms, enterprise Laravel monoliths).
  • Developer onboarding is slow due to inconsistent code patterns.

Look elsewhere if:

  • You’re on Laravel <10 (limited rule coverage for older versions).
  • Your app uses minimal Laravel features (e.g., no Facades, no Eloquent).
  • You prefer manual control over refactoring (e.g., small teams, greenfield projects).
  • Performance-critical paths exist (Rector runs during dev time, not production).
  • You need custom business-logic transformations (use Rector’s generic rules or custom scripts).

How to Pitch It (Stakeholders)

For Executives (Business Impact)

"This tool cuts Laravel upgrade time from weeks to days by automating 90% of breaking-change refactoring. For our [X] project migrating from Laravel 10 to 13, it would save [Y] developer-weeks and reduce upgrade risk by 60% (based on similar projects at [Company Z]). It’s a low-code, high-impact way to modernize our tech stack without hiring additional engineers."

Key Metrics to Highlight:

  • ROI: $X saved in dev hours (e.g., $50K for a 10K LoC upgrade).
  • Risk Reduction: Eliminates human error in manual refactoring.
  • Velocity: Enables faster feature delivery post-upgrade.

For Engineering Leaders (Technical Value)

*"Rector Laravel future-proofs our codebase by:

  1. Automating painful upgrades (e.g., Facades → DI, array_* helpers → Arr::*).
  2. Enforcing modern patterns (e.g., type hints, blank()/filled()) via CI.
  3. Reducing tech debt in legacy systems without rewrites.

How It Works:

  • Zero-config upgrades: Detects your composer.json Laravel version and applies the right rules.
  • Safety first: Runs in a dry mode to preview changes before applying.
  • Extensible: Add custom rules for your app’s specific patterns.

Example Win: [Team A] used it to upgrade a 200K LoC app from Laravel 8 to 13 in 3 days (vs. 3 months manually). We can replicate this for [Project B]."*

Call to Action:

  • Pilot: Run on a non-critical module first (e.g., rector process src/Modules/Analytics --dry-run).
  • CI Integration: Add to PR checks to block deprecated Laravel patterns early.

For Developers (Hands-On)

*"Stop wasting time on boilerplate refactoring—let Rector Laravel handle it:

  • Upgrade Laravel in one command:
    composer require driftingly/rector-laravel --dev
    vendor/bin/rector process src --dry-run
    
  • Fix common anti-patterns automatically:
    • Route::get('/user', 'UserController@index')[UserController::class, 'index'].
    • abort(404)abort_if(true, fn() => abort(404)).
    • dd($user)removed in CI (configurable).
  • Learn modern Laravel: Rules like LARAVEL_STATIC_TO_INJECTION teach you better practices while fixing code.

Pro Tip: Use LARAVEL_CODE_QUALITY set to auto-improve your codebase without breaking it."*

Getting Started:

  1. Install: composer require --dev driftingly/rector-laravel.
  2. Configure rector.php (see docs).
  3. Run: vendor/bin/rector process src --dry-run.
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.
calmfox/watch-sylius
damienfern/grpc-symfony-bundle
atoolo/index-bundle
atoolo/genai-bundle
coprotoai/laravel-ticket
davidjln/llm-carbon-bundle
cryonighter/valid-request-bundle
coolms/taxonomy-bundle
coolms/field-bundle
articulate-orm/symfony
aaix/laravel-tall-architect
ephoto/akeneo-connector
emmanuelballery/eb-plantumlbundle
emielburgman/symfony-visitor-beacon
emielburgman/symfony-visit-storage
emielburgman/symfony-security-headers
emielburgman/symfony-log-viewer
emarref/xdebug-bundle
emarref/pubnub-bundle
elriseio/finance-money-bundle