Configuration

To configure PHP CodeSniffer follow these steps:

1. From the menu bar select Window -> Preferences

Open Preferences

2. From the tree view of Preferences page select PHP Tools -> PHP CodeSniffer. On this page you can configure PHP CodeSniffer.

PHP_CodeSniffer Preferences

3. First select a PHP Executable for running PHP CodeSniffer.

Select PHP Executable

4. You can choose to use your own PEAR library or the internal. Note that the internal library is always within the include path so missing packages are used from there.

Select PEAR Library

5. If you wish to print PHP output to console for debugging activate the checkbox.

Option Debug Output

6. Select one or more included CodeSniffer Standard as Default or add an own. To add a custom standard push New... and provide a Name and a Path to it.

Select PHP_CodeSniffer Standards

7. Select your Tab width.

Standard Tab Width

8. To ignore directories and files you can specifies patterns. Multiple patters are separated by a comma. For example to exclude all lib folders you can use "*/lib/*". Note that you can always use a slash "/" as directory separator.

Ignore Directories and Files

9. Last you can specify sniffs which will be ignored. As name use the source attribute from debug output (for example Generic.Files.LineLengthSniff).

Ignore Sniffs

php_codesniffer_preferences.gif - PHP_CodeSniffer Preferences (46.6 KB) Sven Kiera, 08/26/2010 06:32 pm

preferences_pti_tools_php_executable.gif - Select PHP Executable (17 KB) Sven Kiera, 08/26/2010 06:33 pm

preferences_pti_tools_pear_library.gif - Select PEAR Library (17 KB) Sven Kiera, 08/26/2010 06:33 pm

preferences_pti_tools_debug.gif - Option Debug Output (15.6 KB) Sven Kiera, 08/26/2010 06:34 pm

preferences_codesniffer_standards.gif - Select PHP_CodeSniffer Standards (18.4 KB) Sven Kiera, 08/26/2010 06:35 pm

preferences_codesniffer_standard_tab_width.gif - Standard Tab Width (14.5 KB) Sven Kiera, 08/26/2010 06:35 pm

preferences_codesniffer_ignore_directories_and_files.gif - Ignore Directories and Files (16.3 KB) Sven Kiera, 08/26/2010 06:36 pm

preferences_codesniffer_ignore_sniffs.gif - Ignore Sniffs (15.1 KB) Sven Kiera, 08/26/2010 06:36 pm

window_preferences.gif - Open Preferences (29.9 KB) Sven Kiera, 08/26/2010 06:37 pm