PHPackages                             palpalani/grumphp-rector-task - 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. palpalani/grumphp-rector-task

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

palpalani/grumphp-rector-task
=============================

RectorPhp task runner from GrumPHP

0.9.0(3y ago)684.7k—8.9%[1 issues](https://github.com/palpalani/grumphp-rector-task/issues)MITPHPPHP &gt;=7.4

Since Aug 22Pushed 3y ago1 watchersCompare

[ Source](https://github.com/palpalani/grumphp-rector-task)[ Packagist](https://packagist.org/packages/palpalani/grumphp-rector-task)[ Docs](https://github.com/palpalani/grumphp-rector-task)[ RSS](/packages/palpalani-grumphp-rector-task/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (10)Versions (21)Used By (0)

GrumPHP rector task
===================

[](#grumphp-rector-task)

This package extends [GrumPHP](https://github.com/phpro/grumphp)with a task that runs [RectorPHP](https://github.com/rectorphp/rector) for your Laravel projects or any PHP application.

Note that we have added `--dry-run` option, so the source code never changed.

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

[](#installation)

The easiest way to install this package is through composer:

`composer require --dev palpalani/grumphp-rector-task`

### Config

[](#config)

Add the extension loader to your `grumphp.yml` or `grumphp.yml.dist`. The task lives under the `rector` namespace and has following configurable parameters:

```
# grumphp.yml
grumphp:
    tasks:
        rector:
            whitelist_patterns: []
            config: 'rector.php'
            triggered_by: ['php']
            clear-cache: false
            ignore_patterns: []
            no-progress-bar: false
            files_on_pre_commit: false
            paths: []
            no_diffs: false
    extensions:
        - palPalani\GrumPhpRectorTask\ExtensionLoader
```

By default, this won't update your code, you need to do it manually.

#### whitelist\_patterns

[](#whitelist_patterns)

`Default: []`

If you want to run on particular directories only, specify it with this option.

#### config

[](#config-1)

`Default: 'rector.php'`

If you want to use a different config file than the default `rector.php`, you can specify your custom config file location with this option.

#### triggered\_by

[](#triggered_by)

`Default: [php]`

This option will specify which file extensions will trigger this task.

#### clear-cache

[](#clear-cache)

`Default: false`

Clear cache for already checked files.

#### no-progress-bar

[](#no-progress-bar)

`Default: false`

Hide progress bar. Useful e.g. for nicer CI output.

#### files\_on\_pre\_commit

[](#files_on_pre_commit)

`Default: false`

This option makes it possible to use the changed files as paths during pre-commits. It will use the paths option to make sure only committed files that match the path are validated.

#### no\_diff

[](#no_diff)

`Default: false`

### Sample RectorPhp configuration

[](#sample-rectorphp-configuration)

Create `rector.php` in your project root and configure as follows. This example file iam using for my [Laravel](https://laravel.com/) project, but you can use library with any [PHP](https://www.php.net/) project. Also you no need to set all these settings, Please add or remove as per your requirements.

```
