This is a plugin for Sublime Text which provides checkstyle reports using the following tools (all optional):

You can also configure the plugin to fix the issues using either

Requirements

Requirements for this plugin, should you want all the options to work:

This plugin has been tested on:

Installation

Use Sublime Text’s Package Control (Preferences -> Package Control -> Install Package -> Phpcs) to install this plugin. This is the recommended installation path.

Or

Simply checkout the git repo into “~/Library/Application Support/Sublime Text [VERSION NUMBER]/Packages/ or the equivalent folder on Windows or Linux.

$ cd ~/Library/Application\ Support/Sublime\ Text\ 2/Packages/
$ git clone git://github.com/benmatselby/sublime-phpcs.git Phpcs

In both cases, you may need to then configure the following with the actual path to the application:

They are optional for the plugin. The path needs to include the application such as “/usr/local/bin/phpcs”.

In order to get the path of the application (On a Mac/Linux based environment), you can use:

$ which phpcs
$ which phpmd
$ which php-cs-fixer
$ which phpcbf

Features

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):

Configuration

You can also define the configuration for the following settings, be it for a project, user settings or the default settings:

Plugin

PHP_CodeSniffer

PHP CodeSniffer Fixer

PHP Code Beautifier

PHP Linter

PHP Mess Detector

Scheck

Examples of the settings files can be found here

Project Based Settings

Your .project file should look something like this:

{
    "folders":
    [
        {}
    ],
    "settings":
    {
        "phpcs":
        {
            "phpcs_additional_args":
            {
                "--standard": "/path/to/.composer/vendor/drupal/coder/coder_sniffer/Drupal"
            }
        }
    }
}

Of course this is a example to apply Drupal code sniffer. This could be anything. Whatever you can have on this package settings it can be overwritten under the settings -> phpcs

Changelog

To track the changes more frequently, you can review the Changelog here