diff --git a/README.md b/README.md index 60ddcb4d..f9368dac 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ The WordPress Coding Standards are currently [not compatible with the upcoming P ### Composer -Standards can be installed with [Composer](https://getcomposer.org/) dependency manager: +Standards can be installed with the [Composer](https://getcomposer.org/) dependency manager: composer create-project wp-coding-standards/wpcs --no-dev @@ -60,6 +60,16 @@ Running this command will: For the convenience of using `phpcs` as a global command, you may want to add the `wpcs/vendor/bin` path to a PATH environment in your operating system. +#### Installing WPCS as a dependency + +When installing the WordPress Coding Standards as a dependency in a larger project, the above mentioned step 3 will not be executed automatically. + +There are two actively maintained Composer plugins which can handle the registration of standards with PHP_CodeSniffer for you: +* [composer-phpcodesniffer-standards-plugin](https://github.com/higidi/composer-phpcodesniffer-standards-plugin) +* [phpcodesniffer-composer-installer](https://github.com/DealerDirect/phpcodesniffer-composer-installer) + +It is strongly suggested to `require` one of these plugins in your project to handle the registration of external standards with PHPCS for you. + ### Standalone 1. Install PHP_CodeSniffer by following its [installation instructions](https://github.com/squizlabs/PHP_CodeSniffer#installation) (via Composer, PEAR, or Git checkout). diff --git a/composer.json b/composer.json index 121cdd21..a26ee8b5 100644 --- a/composer.json +++ b/composer.json @@ -13,12 +13,16 @@ "require" : { "squizlabs/php_codesniffer": "^2.9.0" }, + "suggest" : { + "dealerdirect/phpcodesniffer-composer-installer": "*" + }, "minimum-stability" : "RC", "support" : { "issues": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues", "wiki" : "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/wiki", "source": "https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards" }, + "type" : "phpcodesniffer-standard", "scripts" : { "post-install-cmd": "\"vendor/bin/phpcs\" --config-set installed_paths ../../..", "post-update-cmd" : "\"vendor/bin/phpcs\" --config-set installed_paths ../../.."