neos/rector

There is no license information available for the latest version (dev-main) of this package.

Maintainers

Details

github.com/neos/rector

Source

Issues

Fund package maintenance!
shop.neos.io/neosfunding

Installs: 1 673

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 7

Forks: 4

Open Issues: 14

pkg:composer/neos/rector

dev-main 2025-12-12 15:50 UTC

This package is auto-updated.

Last update: 2025-12-12 15:51:08 UTC


README

This package contains a Rector ruleset which is used for migrating from Neos 8.x to 9.0 (and lateron also further up).

Right now we focus especially on rules to migrate from the old Content Repository API (< Neos 9.0) to the Event Sourced Content Repository (>= 9.0).

PHP-only migrations

Earlier version of neos/rector also did the migration of Yaml and Fusion file. They have been moved into Neos core migrations starting version 9.0.8. Now neos/rector only contains PHP migrations.

See for more details: neos/neos-development-collection#5607

Installation

Please install the neos/rector package in your Distribution as a dev dependency with composer.
(This has changed to previous versions of this package)

# inside your Distribution folder
composer require --dev neos/rector:dev-main
cp Packages/Libraries/neos/rector/rector.template.php rector.php

Configuration

Now, open up the rector.php file copied above, and adjust the Rector Paths (these are the paths which shall be migrated). By default, all of ./DistributionPackages will be migrated.

Right now, we ship the following sets of Rector rules:

  • \Neos\Rector\NeosRectorSets::CONTENTREPOSITORY_9_0: all rules needed to migrate to the Event-Sourced Content Repository
$rectorConfig->sets([
    NeosRectorSets::CONTENTREPOSITORY_9_0,
]);

$rectorConfig->paths([
    // TODO: Start adding your paths here, like so:
    __DIR__ . '/DistributionPackages/'
]);

Running

Run the following command at the root of your distribution (i.e. where rector.php is located).

# for trying out what would be done
./bin/rector --dry-run

# for running the migrations
./bin/rector

Developing Rector Rules for Neos

(This section is not relevant for users, but for developers of the Neos Rector packages)

Running Rector after adjusting rules

Make sure to run Rector with the --clear-cache flag while developing rules, when you run them on a full codebase.

Otherwise, Rector might not re-run for unmodified source files.

Running Tests

We develop all Rector Rules completely test-driven.

The test setup runs completely self contained; does not need any Distribution set up.

# if inside a Neos Distribution, change to the Package's folder
cd Packages/Libraries/neos/rector

# install PHPunit 
composer install

# run PHPUnit
composer tests

Generating docs

composer run generate-docs