PHPackages                             drupal8-rector/drupal8-rector - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. drupal8-rector/drupal8-rector

Abandoned → [palantirnet/drupal-rector](/?search=palantirnet%2Fdrupal-rector)Library[Utility &amp; Helpers](/categories/utility)

drupal8-rector/drupal8-rector
=============================

Instant fixes for your Drupal 8 code by using Rector.

2260310[19 issues](https://github.com/drupal8-rector/drupal8-rector/issues)[9 PRs](https://github.com/drupal8-rector/drupal8-rector/pulls)PHP

Pushed 5y ago4 watchersCompare

[ Source](https://github.com/drupal8-rector/drupal8-rector)[ Packagist](https://packagist.org/packages/drupal8-rector/drupal8-rector)[ RSS](/packages/drupal8-rector-drupal8-rector/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersionsUsed By (0)

Rector for Drupal 8
===================

[](#rector-for-drupal-8)

Apply automatic fixes on your Drupal 8 code.

Check it in action on [Travis CI](https://travis-ci.org/drupal8-rector/drupal8-rector/builds).

Installation
------------

[](#installation)

Install the library.

```
$ composer require --dev drupal8-rector/drupal8-rector
```

Create a rector.yml file in the Drupal 8 root.

```
imports:
  - { resource: "%vendor_dir%/drupal8-rector/drupal8-rector/config/drupal8.yml" }
  - { resource: "%vendor_dir%/drupal8-rector/drupal8-rector/config/drupal86-deprecations.yml" }
  # Import drupal8-php71.yml ruleset if your module's minimum requirement
  # is PHP >= 7.1.
  # - { resource: "%vendor_dir%/drupal8-rector/drupal8-rector/config/drupal8-php71.yml" }
  # Enable EXPERIMENTAL rectors.
  # - { resource: "%vendor_dir%/drupal8-rector/drupal8-rector/config/drupal8-experimental.yml" }

parameters:
  autoload_paths:
    - 'web/core/modules'
    - 'web/modules'
  exclude_paths:
    - '*/tests/*'
    - '*/Tests/*'

services:
    # Optionally enable ReturnTypeDeclarationRector rector if your
    # code is PHP >= 7.1 compatible. It is disabled by default
    # because it may cause problems.
    # Drupal8Rector\Rector\FunctionLike\ReturnTypeDeclarationRectorProxy: ~
```

Suggested workflow
==================

[](#suggested-workflow)

1. Analyze your code with Rector and review suggested changes:

```
$ vendor/bin/rector process web/modules/contrib/[YOUR_MODULE] --dry-run
```

2. Apply suggested changes:

```
$ vendor/bin/rector process web/modules/contrib/[YOUR_MODULE]
```

3. Automatically correct code style violations with PHPCBF:

```
$ vendor/bin/phpcbf --standard=web/core/phpcs.xml.dist web/modules/contrib/[YOUR_MODULE] -s --colors
```

4. Look for remaining code style violations with PHPCS:

```
$ vendor/bin/phpcs --standard=web/core/phpcs.xml.dist web/modules/contrib/[YOUR_MODULE] -s --colors
```

5. Run automated tests to ensure the optimized code is still correct:

```
$ vendor/bin/phpunit -c web/core --printer="\Drupal\Tests\Listeners\HtmlOutputPrinter" -v --debug web/modules/contrib/[YOUR_MODULE]/tests
```

You can find more information about Rector [here](https://github.com/rectorphp/rector).

Known issues
------------

[](#known-issues)

- Rector conflict with the PHPUnit version (^6.5 required by webflo/drupal-core-require-dev package) on the required minimum version from sebastian/diff package. Possible solution: temporarily remove webflo/drupal-core-require-dev package while you are testing this library.

Roadmap
-------

[](#roadmap)

This is just a POC at this moment but it has a great potential to become an actual development tool for Drupal 8.

*Do you have an idea about what else this tool could do? Please share it in the issue queue. Pull requests are also warmly welcomed!*

Credits
-------

[](#credits)

Initial development is sponsored by [Pronovix](https://pronovix.com).

###  Health Score

13

—

LowBetter than 1% of packages

Maintenance3

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity8

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a39930748464d7f7a251984080a21ce132f6ae9b0d086b392eb22ee6aeba4278?d=identicon)[mxr576](/maintainers/mxr576)

![](https://www.gravatar.com/avatar/80c5186e6a3dadc1c6899a32d328d4c4f1b55b9ae7be4221a8b9ebaab7af9473?d=identicon)[drupal8-rector](/maintainers/drupal8-rector)

---

Top Contributors

[![mxr576](https://avatars.githubusercontent.com/u/1755573?v=4)](https://github.com/mxr576 "mxr576 (68 commits)")

### Embed Badge

![Health badge](/badges/drupal8-rector-drupal8-rector/health.svg)

```
[![Health](https://phpackages.com/badges/drupal8-rector-drupal8-rector/health.svg)](https://phpackages.com/packages/drupal8-rector-drupal8-rector)
```

###  Alternatives

[philippfrenzel/yii2fullcalendar

Yii2 fullcalendar Widgets

135641.8k6](/packages/philippfrenzel-yii2fullcalendar)[theodo-evolution/legacy-wrapper-bundle

40124.5k](/packages/theodo-evolution-legacy-wrapper-bundle)[doekenorg/iterator-functions

A package that provides array\_\* like functions for iterators.

675.3k](/packages/doekenorg-iterator-functions)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
