Skip to content

Commit 438a415

Browse files
committed
docs: update docs for version auto-detection
1 parent 169cbec commit 438a415

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

README.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,22 @@ composer require --dev driftingly/rector-laravel
2323

2424
## Automate Laravel Upgrades
2525

26-
To add a set to your config, use `RectorLaravel\Set\LaravelLevelSetList` and pick the constant that matches your target version.
26+
To automatically apply the correct rules depending on the version of Laravel (or other packages) you are currently on (as detected in the `composer.json`), use the following:
27+
28+
```php
29+
<?php declare(strict_types=1);
30+
31+
use Rector\Config\RectorConfig;
32+
use RectorLaravel\Set\LaravelSetProvider;
33+
34+
return RectorConfig::configure()
35+
->withSetProviders(LaravelSetProvider::class)
36+
->withComposerBased(laravel: true, /** other options */);
37+
```
38+
39+
### Manual Configuration
40+
41+
To manually add a version set to your config, use `RectorLaravel\Set\LaravelLevelSetList` and pick the constant that matches your target version.
2742
Sets for higher versions include sets for lower versions.
2843

2944
```php

0 commit comments

Comments
 (0)