CLI Options
Rector has one main command, process. It is the default, so these two are the same:
vendor/bin/rector process src
vendor/bin/rector src
Paths are optional. Without them, Rector uses withPaths() from rector.php.
Options you will use every day#
| Option |
What it does |
--dry-run, -n |
Show the diff, change nothing. Use it in CI and before every real run. |
--config=FILE, -c |
Config file other than rector.php. |
--only=RULE |
Run a single rule from the config, repeat for several. See Run single rule. |
--filter=PATTERN |
Keep only files matching the pattern. See Filter Files. |
--clear-cache |
Drop the cache before the run. Use it when a rule change is not picked up. |
--debug |
Nested exception output, parallel disabled. See Debugging. |
Narrow the run#
| Option |
What it does |
--composer-based |
Only rules bound to an installed composer package version. See Composer-Based Sets. |
--php |
Only PHP upgrade rules. |
--max-changes=N |
Stop after N changes and leave the rest untouched. Handy for a first small pull request. Forces a non-parallel run. |
Output#
| Option |
What it does |
--output-format=FORMAT |
console (default), json, github or gitlab. The last two print annotations your CI shows inline. |
--no-progress-bar |
Hide the progress bar, nicer CI logs. |
--no-diffs |
Hide diffs of changed files. |
--rules-summary |
Print which rules changed how many files. |
--ansi, --no-ansi |
Force or disable colors. |
Environment#
| Option |
What it does |
--memory-limit=LIMIT |
Memory limit for the run, e.g. --memory-limit=2G. |
--autoload-file=FILE, -a |
Extra autoload file to include. See Static Reflection and Autoload. |
--xdebug |
Allow Xdebug, which Rector disables by default for speed. |
Run vendor/bin/rector process --help for the full list.