muhammadsadeeq / laravel-upgrades-rector
Automated Laravel version upgrade rules for Rector. Supports Laravel 10 through 13 with 64 rules covering breaking changes, dependency updates, and contract migrations.
Package info
github.com/MuhammadSadeeq/laravel-upgrades-rector
Type:rector-extension
pkg:composer/muhammadsadeeq/laravel-upgrades-rector
Requires
- php: ^8.3
- rector/rector: ^1.0 || ^2.0
Requires (Dev)
- phpstan/phpstan: ^1.10 || ^2.0
- phpunit/phpunit: ^11.0
README
Laravel Upgrades Rector
Automate your Laravel upgrades with 64 Rector rules covering Laravel 10 through 13.
Installation
composer require --dev muhammadsadeeq/laravel-upgrades-rector
Usage
# Preview changes vendor/bin/rector process --dry-run --config=vendor/muhammadsadeeq/laravel-upgrades-rector/config/laravel-13.php # Apply changes vendor/bin/rector process --config=vendor/muhammadsadeeq/laravel-upgrades-rector/config/laravel-13.php
Replace laravel-13.php with laravel-12.php or laravel-11.php for older upgrades.
These config names and set constants refer to the target upgrade version, so laravel-13.php / LaravelUpgradeSetList::LARAVEL_13 means “upgrade the project to Laravel 13.”
The Laravel 11, Laravel 12, and Laravel 13 sets can also rewrite the nearest project composer.json when a supported dependency update applies.
Supported Versions
| Upgrade Path | Rules |
|---|---|
| Laravel 12 → 13 | 20 rules |
| Laravel 11 → 12 | 14 rules |
| Laravel 10 → 11 | 31 rules |
Cumulative sets are available to upgrade across multiple versions at once.
Custom Configuration
<?php use Rector\Config\RectorConfig; use MuhammadSadeeq\LaravelUpgradesRector\Set\LaravelUpgradeSetList; return RectorConfig::configure() ->withSets([ LaravelUpgradeSetList::LARAVEL_13, // LARAVEL_11, LARAVEL_12, LARAVEL_13 for single-version upgrades // UP_TO_LARAVEL_12, UP_TO_LARAVEL_13 for cumulative upgrades ]) ->withPaths([ __DIR__ . '/app', __DIR__ . '/bootstrap', __DIR__ . '/config', __DIR__ . '/database', ]);
Documentation
Full Documentation — Detailed rule reference, example transformations, architecture overview, and troubleshooting.
Testing
composer test
composer analyse
Current verification: 279 tests, 407 assertions, and PHPStan at max level with zero errors.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
Credits
License
The MIT License (MIT). Please see LICENSE.md for more information.