Install PHPCodeSniffer in Windows and install PHPCodeSniffer1. download PHP_CodeSniffer1.3.6: http://download.pear.php.net/package/PHP_ Windows install PHP CodeSniffer in PHPStorm and use PHPStorm
Install PHP CodeSniffer in Windows
1. download PHP_CodeSniffer 1.3.6: http://download.pear.php.net/package/PHP_CodeSniffer-1.3.6.tgz2. unzip to Directory: d: \ dev \ tools \ PHP_CodeSniffer-1.3.63. modify script/phpcs. bat file? ? ? 1) @ php_bin @ replace with the path of the local PHP execution File: D: \ xampp \ php \ php.exe? ? ? 2) @ php_dir @ replace with PHP CodeSniffer Directory: d: \ dev \ tools \ PHP_CodeSniffer-1.3.6? ? ? 3) @ bin_dir @ \ phpcs replace with phpcs script path: d: \ dev \ tools \ PHP_CodeSniffer-1.3.6 \ scripts \ phpcs? ? ? Command line example: "D: \ xampp \ php \ php.exe"-d auto_append_file = ""-d auto_prepend_file = ""-d include_path = "'d: \ dev \ tools \ PHP_CodeSniffer-1.3.6 '"-f" d: \ dev \ tools \ PHP_CodeSniffer-1.3.6 \ scripts \ phpcs "-- % * 4. after the installation is complete, you can use a php file to test :? ? ? 1) input in the command line: d: \ dev \ tools \ PHP_CodeSniffer-1.3.6 \ scripts \ phpcs. bat? Test. php can see output similar to the following :? ? ?
Use PHP CodeSniffer in PHPStormTaking PHPStorm 5 as an example (PS: This function does not seem to be easy to use and hung is easy to use. after opening the code file, the check will be delayed for several seconds) 1. choose File> Settings2. under Project Settings, select PHP> Code Sniffer3. set PHP Code Sniffer (phpcs) path to D: \ dev \ tools \ PHP_CodeSniffer-1.3.6 \ scripts \ phpcs. bat4. click the Validate button. the following prompt is displayed, indicating that the setting is OK :? ? ? 5. select Inspections under Project Settings, expand PHP, and check PHP Code Sniffer validation6. click the refresh button for the first time to obtain the installed Code specifications. select one, Apply configuration? ? ? 8. open a php file and you will be able to see the prompt for non-conforming rules? ? ?