Verify the path is set correctly by running phpcs -config-show.The command looks like phpcs -config-set installed_paths , If you copied any paths in step 2, include them here as well by separating them with a comma. Set the Joomla Coding Standards path in phpcs by executing phpcs -config-set installed_paths /Users/user/.composer/vendor/joomla/coding-standards.In step 2, if you see the installed_paths you need to copy that.You can get an answer that looks like this: installed_paths: /path/to/installation.Check if certain paths are already set by running phpcs -config-show.
If you can't find it in any of the above folders, note that the folder you are looking for ends with \joomla\coding-standards\ Finally we need to tell Code Sniffer that the Joomla coding standards exist. ~/.config/composer/vendor/joomla/coding-standards/Ĭ:\Users\Username\AppData\Roaming\Composer\vendor\joomla\coding-standards\ ~/.composer/vendor/joomla/coding-standards/ The location of this folder depends on your operating system.
Once the installation is done the coding standard will be installed in the global composer folder. The requested package joomla/coding-standards ~3.0 is satisfiable by joomla/coding-standards but these conflict with your requirements or minimum-stability. Your requirements could not be resolved to an installable set of packages.
If we do not include the the coding standards will not install and throw this error.
Using composer we can execute: composer global require joomla/coding-standards that it says that is because the coding standard is still in alpha state and we need to allow the installation of alpha status code. In order to have PHP Code Sniffer (phpcs) sniffing your Joomla projects for the right code style, you have to install the Joomla Coding Standards. bash_profile file depending which shell you are using (echo $SHELL shows you which one you are using).Īdd the following line to the file: export PATH=$PATH:~/.composer/vendor/binĪlternatively you can also create a symbolic link in the bin folder: ln -s ~/.composer/vendor/bin/phpcs /usr/local/bin/phpcs To do this persistent edit your shells start file, like your. composer/vendor/bin to your $PATH variable.
In order to execute PHP Code sniffer from anywhere on Linux or Mac command line you have to add.
On Windows PHP Code Sniffer (phpcs) will be installed under your user folder: