composer global require squizlabs/php_codesniffer
composer global require wp-coding-standards/wpcs
Installation Test: Run the below command for checking phpcs
is installed correctly.
phpcs -i
Problem Fix: command not found: phpcs
To fix this problem, add the phpcs
path to your PATH variable.
phpcs
and phpcbf
installed path.
/Users/your_username/.composer/vendor/bin/phpcs
/Users/your_username/.composer/vendor/bin/phpcbf
[Note] change your_username
[Note] change your_username
phpcs --config-set installed_paths /Users/your_username/.composer/vendor/wp-coding-standards/wpcs
Default Standard Set default CS
phpcs --config-set default_standard WordPress
Installation Test
phpcs --config-show
phpcs abc.php
phpcbf abc.php