driftingly / rector-laravel
Rector upgrades rules for Laravel Framework
Installs: 3 201 870
Dependents: 70
Suggesters: 0
Security: 0
Stars: 547
Watchers: 11
Forks: 53
Open Issues: 9
Type:rector-extension
Requires
- php: ^7.2 || ^8.0
- rector/rector: ^1.0
- dev-main
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.0
- 0.41.0
- 0.40.0
- 0.30.0
- 0.29.0
- 0.28.1
- 0.28.0
- 0.27.0
- 0.26.2
- 0.26.1
- 0.26.0
- 0.25.0
- 0.24.1
- 0.24.0
- 0.23.0
- 0.22.1
- 0.22.0
- 0.21.0
- 0.20.0
- 0.19.0
- 0.18.0
- 0.17.0
- 0.16.1
- 0.16.0
- 0.15.0
- 0.14.2
- 0.14.1
- 0.14.0
- 0.13.1
- 0.13.0
- 0.11.16
- 0.11.15
- 0.11.14
- 0.11.13
- 0.11.12
- 0.11.11
- 0.11.10
- 0.11.9
- 0.11.8
- 0.11.7
- 0.11.6
- 0.11.5
- 0.11.4
- 0.11.3
- 0.11.2
- 0.11.1
- 0.11.0
- 0.10.2
- 0.10.1
- 0.10.0
- dev-feature/where-to-where-like
- dev-feature/remove-null-coalesce-for-default
- dev-laravel-11-new-generic-types
- dev-feature/global-to-request-facade
- dev-feature/env-var-to-env-helper
- dev-complete-rules-for-laravel-53
- dev-feature/declare-type-configs
- dev-feature/new-instance-to-container-get
- dev-feature/throw-exception-to-class-string-and-parameters
This package is auto-updated.
Last update: 2024-10-28 16:21:53 UTC
README
Rector Rules for Laravel
See available Laravel rules
Install
This package is a Rector extension developed by the Laravel community.
Rules for additional first party packages are included as well e.g. Cashier and Livewire.
Install as a dev dependency:
composer require --dev driftingly/rector-laravel
Automate Laravel Upgrades
To add a set to your config, use RectorLaravel\Set\LaravelLevelSetList
and pick the constant that matches your target version.
Sets for higher versions include sets for lower versions.
<?php declare(strict_types=1); use Rector\Config\RectorConfig; use RectorLaravel\Set\LaravelLevelSetList; return RectorConfig::configure() ->withSets([ LaravelLevelSetList::UP_TO_LARAVEL_110, ]);
The sets in RectorLaravel\Set\LaravelSetList
only contain changes related to a specific version upgrade.
For example, the rules in LaravelSetList::LARAVEL_110
apply when upgrading from Laravel 10 to Laravel 11.
Additional Sets
To improve different aspects of your code, use the sets in RectorLaravel\Set\LaravelSetList
.
<?php declare(strict_types=1); use Rector\Config\RectorConfig; use RectorLaravel\Set\LaravelSetList; return RectorConfig::configure() ->withSets([ LaravelSetList::LARAVEL_CODE_QUALITY, LaravelSetList::LARAVEL_COLLECTION, ... ]);
Contributors
Thank you everyone who works so hard on improving this package:
A special thank you to Caneco for designing the logo!
Hire The Rector Team
Rector is a tool that we develop and share for free, so anyone can automate their refactoring. But not everyone has dozens of hours to understand complexity of abstract-syntax-tree in their own time. That's why we provide commercial support - to save your time.
Would you like to apply Rector on your code base but don't have time for the struggle with your project? Hire the Rector team to get there faster.
Learn Rector Faster
Not everyone has time to understand Rector and AST complexity. You can speed up the process by reading the book The Power of Automated Refactoring. Not only will it help you learn and understand Rector but it supports the project as well.