Skip to main content

PHP-CS-Fixer

Installation

You should install this package using the Composer bin plugin.

composer bin cs-fixer require --dev 21torr/php-cs-fixer

Then add the following scripts to your composer.json, to always and automatically keep these dependencies up to date:

"scripts": {
"post-install-cmd": [
"@composer bin all install --ansi"
],
"post-update-cmd": [
"@composer bin all update --ansi"
]
}

Now you should ignore the nested vendor directories in your .gitignore:

/vendor-bin/*/composer.lock
/vendor-bin/*/vendor

Usage

After installation, you can run the tools like this:

./vendor/bin/php-cs-fixer fix --dry-run --diff --config vendor-bin/cs-fixer/vendor/21torr/php-cs-fixer/.php-cs-fixer.dist.php