PHPCodeSniffer assembly in Windows and used in PHPStorm

Source: Internet
Author: User
Install PHPCodeSniffer in Windows and use PHPStorm to install PHPCodeSniffer1. download PHP_CodeSniffer1.3.6: download. pear. php. netpackagePHP_CodeSniffer-1.3.6.tgz2. unzip to Directory: d: devto install PHP CodeSniffer in Windows 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.tgz

2. decompress to Directory: d: \ dev \ tools \ PHP_CodeSniffer-1.3.6

3. modify the script/phpcs. bat file

? ? ? 1) replace @ php_bin @ 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. the installation is complete. you can test it using a php file:

? ? ? 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 PHPStorm

Taking 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. click File> Settings.

2. select PHP> Code Sniffer under Project Settings.

3. set PHP Code Sniffer (phpcs) path to: D: \ dev \ tools \ PHP_CodeSniffer-1.3.6 \ scripts \ phpcs. bat

4. 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 validation.

6. when you open it for the first time, you need to click the refresh button to obtain the installed code specifications.

7. select one and configure Apply.

? ? ?

8. open a php file and you will be able to see the prompt for non-conforming rules.

? ? ?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.