PHP CodeSniffer, Linter and Mess Detector Plugin For Sublime Text 2
This is a plugin for Sublime Text 2 which enables the user to right click on files and generate an error report for PHP (and css/js for that matter) files using the PHP_CodeSniffer, Linter and PHP Mess Detector.
Features
- Ability to run PHP_CodeSniffer
- Ability to run php -l on the open file
- Ability to run PHP Mess Detector on the open file
- Show cached results from PHP_CodeSniffer in open file
- Show errors in the Quick Panel
- Show errors in the Gutter
- Show the error for a given line in the status bar
- Ability to specify the regular expression of the linter errors
- Ability to specify the location of the PHP_CodeSniffer application
- Ability to specify the location of the PHP Mess Detector application
Once you have right clicked on a file and selected "PHP CodeSniffer" > "Sniff this file..." you will get the output as shown below (depending on the settings you have defined):
Quick Panel

Gutter Marks

Status Bar
If you click on a line with an error, the status bar will be updated to show the error:

Configuration
You can also define the configuration for the following settings:
- extensions_to_execute - Which filetypes do you want the plugin to execute for?
- phpcs_php_path - The path to the PHP executable. If empty string, use PATH to find it
- phpcs_additional_args - This is the extra information you want to pass to the phpcs command. For example which “standard” you want to run, and if you want to show warnings or not
- phpcs_execute_on_save - Do you want the code sniffer plugin to run on file save for php files?
- phpcs_show_gutter_marks - Do you want the errors to be displayed in the gutter?
- phpcs_show_quick_panel - Do you want the errors to be displayed in the quick panel?
- phpcs_linter_run - Do you want the PHP linter to run?
- phpcs_linter_regex - The regex for the PHP linter output
- phpcs_executable_path - The path to the phpcs executable. If empty string, use PATH to find it
- phpcs_show_errors_on_save - Do you want the errors to be displayed in quick_panel on save?
- phpcs_show_errors_in_status - Do you want the errors to be displayed in status bar when clicking on the line with error?
- phpmd_run - Do you want the PHPMD to run? Off by default
- phpmd_executable_path - The path to the phpmd executable. If empty string, use PATH to find it
- phpmd_additional_args - This is the extra information you want to pass to the phpcs command. For example which "rulesets" you want to run
You can set these options by following this menu path:

Installation
You can install this in one of two ways:
- Package Control (Recommended)
- Git - Simply checkout the git repo into "~/Library/Application Support/Sublime Text 2/Packages/Phpcs" or the equivalent folder on Windows or Linux.
Changelog
To track the changes more frequently, you can review the Changelog here