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

Rector Laravel Laravel Package

driftingly/rector-laravel

Community-maintained Rector extension for Laravel. Apply automated refactoring rules to upgrade Laravel (and first-party packages like Cashier/Livewire) via composer-based detection or manual version sets, helping modernize codebases safely and consistently.

View on GitHub
Deep Wiki
Context7

driftingly/rector-laravel is a community-built Rector extension that codemods Laravel applications to modern, compatible code. It helps you automate framework (and related package) upgrades by applying the right transformation rules based on your project’s installed versions—or by selecting sets manually.

  • Composer-aware upgrades via LaravelSetProvider and withComposerBased()
  • Versioned rule sets (e.g. UP_TO_LARAVEL_130) where higher sets include lower ones
  • Manual set selection with LaravelLevelSetList / LaravelSetList for targeted upgrades
  • Includes rules for first-party packages like Cashier and Livewire
  • Browse an overview of all available rules in the included docs and Rector “Find Rule” page
Frequently asked questions about Rector Laravel
How do I install driftingly/rector-laravel for Laravel 13+ upgrades?
Run `composer require --dev driftingly/rector-laravel` to install it as a dev dependency. Ensure you have Rector installed (`composer require --dev rector/rector`). The package integrates seamlessly with Laravel’s composer.json for version detection.
Can I use this package to upgrade from Laravel 10 to 13 without manual refactoring?
Yes, use `LaravelLevelSetList::UP_TO_LARAVEL_130` in your Rector config. This set includes all incremental rules needed for upgrades from Laravel 10/11/12 to 13, ensuring compatibility at each step.
What Laravel 13-specific rules does this package include?
The package includes rules for Model Attributes (e.g., `$casts`, `$attributes`), Queue Job attributes (`@onQueue`), and middleware renaming (e.g., `PreventRequestForgery`). These align with Laravel 13’s latest syntax and best practices.
How does composer-based detection work for Laravel versions?
Use `LaravelSetProvider::class` in your Rector config with `withComposerBased(laravel: true)`. The package reads your `composer.json` to auto-detect your Laravel version and apply the correct rule set.
Will this package break my existing Livewire 3.x code if I upgrade to Laravel 13?
No, but you may need to manually select `LaravelLevelSetList::UP_TO_LARAVEL_130` to ensure Livewire 4.0 compatibility rules are applied. The package includes fixes for Livewire 4.0’s associative array handling.
How do I test Rector rules before applying them to my production code?
Run Rector with the `--dry-run` flag to preview changes without modifying files. Example: `rector process --dry-run`. Always test in a staging environment or CI pipeline before production deployment.
Are there any risks of false positives when using Laravel 13 rules on older Laravel versions?
Yes, Laravel 13-specific rules (e.g., Model Attributes) won’t apply to pre-Laravel 13 codebases unless explicitly configured. Use `UP_TO_LARAVEL_130` for incremental upgrades to avoid unintended rule application.
Does this package support custom Laravel attributes or third-party packages beyond Cashier/Livewire?
The package focuses on Laravel’s first-party packages (Cashier, Livewire) and core framework upgrades. For custom attributes or non-Laravel ORMs, manual rule configuration or forking may be required.
How can I integrate this with Laravel Pint for consistent code formatting?
Run Rector first to modernize your code, then use Laravel Pint with the `LARAVEL_CODE_QUALITY` preset. This ensures your code is both syntactically modern and consistently formatted.
What should I do if a Rector rule fails during a Laravel upgrade?
Check the error logs and use `--dry-run` to isolate the issue. For complex cases, manually review the rule’s documentation or disable it in your Rector config. Report issues to the GitHub repository for community support.
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport