git404hub

what is rector fr?

rectorphp/rector — explained in plain English

Analysis updated 2026-06-24

10,300PHPAudience · developerComplexity · 3/5Setup · moderate

tl;dr

Rector is a command-line tool that automatically upgrades and rewrites PHP code, point it at your project and it applies the changes needed to move to a newer PHP or framework version without manual editing.

vibe map

mindmap
  root((Rector))
    What It Does
      Automated code upgrade
      Rule-based rewriting
      CI enforcement
    Supported Targets
      PHP 5.3 to 8.5
      Symfony and Doctrine
      PHPUnit and Laravel
    How It Works
      AST parsing
      Dry-run preview
      rector.php config
    Known Limits
      Whitespace loss after rewrite
      Windows parallel mode issues

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

what do people make with this?

VIBE 1

Automatically update a PHP 7 codebase to PHP 8 syntax by running Rector with the appropriate upgrade rule set.

VIBE 2

Add Rector to a CI pipeline to enforce code quality rules and reject PRs that introduce deprecated patterns.

VIBE 3

Migrate a Symfony, PHPUnit, or Doctrine project to a newer major version by applying the relevant named rule sets.

VIBE 4

Preview every change Rector will make as a diff using dry-run mode before any files are modified.

what's the stack?

PHPComposer

how it stacks up fr

rectorphp/rectoranankke/sspanel-uimwoocommerce/woocommerce
Stars10,30010,30410,291
LanguagePHPPHPPHP
Setup difficultymoderatehardhard
Complexity3/54/54/5
Audiencedeveloperops devopsdeveloper

Figures from each repo's GitHub metadata at analysis time.

how do i run it?

Difficulty · moderate time til it works · 30min

Run a formatter like ECS after Rector because AST re-serialization may alter whitespace and code style.

in plain english

Rector is a command-line tool for PHP developers that automatically upgrades and rewrites PHP code. Instead of manually tracking deprecations or breaking changes when moving to a newer version of PHP or a framework like Symfony, PHPUnit, or Doctrine, you point Rector at your codebase and it applies the necessary transformations for you. It supports PHP versions from 5.3 up to 8.5. The tool works by parsing your PHP files into an abstract syntax tree, applying transformation rules, and writing the modified files back. You configure it with a rector.php file at the root of your project, where you specify which individual rules or named rule sets to run. A dry-run mode lets you preview every change as a diff before anything is actually written, so you can inspect the proposed modifications first. Beyond version upgrades, Rector can be added to a continuous integration pipeline to enforce code quality rules automatically. If your team introduces patterns you want to avoid, a Rector rule can catch and rewrite them on every commit, acting as a kind of automated code review for structural issues. There is an active community that maintains rule sets for specific PHP frameworks and platforms beyond the core ones, including Drupal, Laravel, Shopware, TYPO3, CakePHP, Silverstripe, and others. The company behind Rector also offers paid consulting for teams that want help applying it to large or complex codebases. A known limitation is that because the tool parses and re-serializes PHP through an AST library, the output may lose original whitespace and formatting. The recommendation is to run a separate code formatter like ECS after Rector to clean up the style. On Windows, there can also be issues with parallel processing mode that may require switching to a command prompt terminal.

prompts (copy fr)

prompt 1
I have a PHP 7.4 project and want to upgrade it to PHP 8.2. Write a rector.php config file that applies all relevant upgrade rules and enables the new PHP 8 syntax features.
prompt 2
Help me add Rector to a GitHub Actions CI pipeline so pull requests are blocked if they introduce patterns that my rector.php rules flag.
prompt 3
Show me how to write a custom Rector rule that automatically replaces all calls to a deprecated function with its recommended replacement.
prompt 4
After running Rector my code formatting is inconsistent. Show me how to integrate ECS (Easy Coding Standard) as a follow-up step to restore consistent style.

Frequently asked questions

what is rector fr?

Rector is a command-line tool that automatically upgrades and rewrites PHP code, point it at your project and it applies the changes needed to move to a newer PHP or framework version without manual editing.

What language is rector written in?

Mainly PHP. The stack also includes PHP, Composer.

How hard is rector to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is rector for?

Mainly developer.

peek the repo → explain another one

This repo across BitVibe Labs

double-check against the repo, no cap.