Rector: Install Rector globally

Created on 21 Dec 2017  路  5Comments  路  Source: rectorphp/rector

Is possible to install Rector globally with composer, like PHPUnit and PHP-CS-Fixer, and use it? :zap:

All 5 comments

What happened when you tried that?

Sorry, I was missing the --dev flag. Got this working without it:

- composer global require --dev rector/rector @dev nikic/php-parser '4.0.x-dev'
+ composer global require rector/rector @dev nikic/php-parser '4.0.x-dev'

I recall I had many troubles with compser global at @ApiGen, so let's not promote this way of install to not waste time with that.

Preffered way to one path is composer create-project *, see: https://getrector.org/blog/2020/01/20/how-to-install-rector-despite-composer-conflicts

For anyone who is coming to this issue through google and finding that the link mentioned in @TomasVotruba 's last comment is broken, you can follow this approach instead if you have dependency conflicts in your project vs Rector:
https://getrector.org/blog/2020/01/20/how-to-install-rector-despite-composer-conflicts

In case that link breaks:

composer require rector/rector-prefixed
vendor/bin/rector

I've updated the link, thanks :+1:

Was this page helpful?
0 / 5 - 0 ratings