Install PHP Code snifferphp codesniffer in Phpstorm
PHP Codesniffer is a PHP code style detector written in pear with PHP5, which checks the code style of the app against a set of pre-set coding standards based on pre-programmed PHP coding styles and rules, with built-in Zend Pear's coding style rules, of course, also support their own customization. PHP Codesniffer is an essential development tool to ensure the simplicity and consistency of your code, and it can even help programmers reduce some semantic errors.
Installing Php_codesniffer
Method 1: Install PHP Code Sniffer using pear (ie: PHP extensions and application repositories)
pear install PHP_CodeSniffer
The code package is automatically downloaded to the Pear configuration directory after execution
> Premise: You need to install PEAR Package management tool, please own Baidu
Method 2: Go directly to the website to download the code package
Apply to Phpstorm
Open the Phpstorm Settings page to the Code sniffer page
Setting->Languages and Frameworks->PHP->Code Sniffer
In the PHP Code Sniffer (phpcs) Path option, select the execution file for Codesniffer. Press Validate to indicate success if a green word appears below.
Pear Installation Method
在 PEAR 根目下(xxx\php\phpcs.bat)
Download the Code package method
在解压目录(xxx\bin\phpcs.bat)
> Linux Systems Select the script without the. bat suffix
![](http://images2017.cnblogs.com/blog/1147729/201712/1147729-20171220101331303-790121717.png)
Open PHP Code Sniffer
Setting->Editor->Inspections->PHP->PHP Code Sniffer validation勾选上然后在右边的 Coding standard 按下刷新按鈕,成功的话,点击下拉按钮就会有可供选择的标准
![](http://images2017.cnblogs.com/blog/1147729/201712/1147729-20171220101840725-130995876.png)
After pressing the application, we can see that Codesniffer started to test us in time.
Effect Show
> The effect can be adjusted in the configuration, the default is the gray underline the wavy line (I am configured as a red background, I want to be glaring), the mouse hover cue line, will display the prompt text.
Installing PHP Code Sniffer in Phpstorm