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

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

Rector upgrades rules for Laravel

Frequently asked questions about Rector Laravel
How do I install driftingly/rector-laravel for Laravel version upgrades?
Run `composer require --dev driftingly/rector-laravel` to install it as a dev dependency. The package integrates with Rector, so ensure you also have `rector/rector` installed. Configuration is minimal—just enable Laravel-specific sets in your Rector config.
Does this package support upgrading from Laravel 9 to 13 directly?
Yes, but it’s recommended to upgrade incrementally (e.g., 9→10→11→12→13) to minimize breaking changes. The package auto-detects your current Laravel version via `composer.json` and applies rules for the target version. For direct upgrades, manually select `LaravelLevelSetList::UP_TO_LARAVEL_130` in your config.
Can I use this to replace manual Facade alias updates (e.g., `Hash::make()` to `Hash::digest()`)?
Absolutely. The package includes rules like `LARAVEL_FACADE_ALIAS_TO_STATIC_CALL` to automate these updates. Run Rector with `--dry-run` first to preview changes, then apply them incrementally to avoid conflicts.
Will this break my existing Livewire or Cashier code during upgrades?
The package includes rules for Livewire and Cashier, but some breaking changes (e.g., static method removals) may still occur. Test thoroughly in a staging environment or use feature flags to roll out changes gradually. Check the [Rector Find Rule](https://getrector.com/find-rule?activeRectorSetGroup=laravel) for Livewire/Cashier-specific rules.
How do I configure Rector to auto-detect my Laravel version from composer.json?
Use `LaravelSetProvider` in your Rector config and enable `withComposerBased(laravel: true)`. This automatically selects the correct rule set based on your `composer.json` without manual version specification. Example: `LaravelSetProvider::class` in your `rector.php` config.
Does this package handle database schema changes (e.g., renaming columns for Laravel Auth)?
No, this package focuses on PHP code refactoring, not database migrations. Use Laravel’s built-in migrations or tools like Doctrine DBAL for schema changes. Rector will update your model queries (e.g., Eloquent) to match the new schema, but you must manually write the migration.
Can I run this in CI to block deprecated Laravel patterns before merging?
Yes, integrate Rector into your CI pipeline (e.g., GitHub Actions) with a step like `rector process src --dry-run`. Fail the build if deprecated patterns (e.g., Facade aliases) are detected. Combine with PHPStan for stricter enforcement.
What’s the best way to test Rector changes before applying them to production?
Start with `--dry-run` to review diffs, then test in a staging environment mirroring production. Use Docker or a disposable VM to isolate changes. For critical apps, run Rector on a feature branch and verify all tests pass before merging.
Are there rules for third-party Laravel packages (e.g., Spatie, Laravel Nova)?
The package includes rules for Laravel’s first-party packages (Livewire, Cashier) but lacks coverage for most third-party packages. For Spatie or Nova, you’ll need to create custom rules or wait for community contributions. Check the [Rector Find Rule](https://getrector.com/find-rule) for updates.
How do I exclude specific files or directories from Rector processing?
Use the `--skip` flag to exclude files/directories, e.g., `rector process src --skip=tests/Feature`. You can also configure exclusions in your Rector config via `->withExcludedPaths()`. This is useful for legacy code or vendor files that shouldn’t be modified.
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.
boundwize/jsonrecast
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata