PHPCode Sniffer + Sublime on windows

Things you need for:

  1. cmder
  2. composer
  3. Sublime Text 2/3

We are going to install using composer, because it will automatically install related packages. So no need to do too many manual stuffs.

Step 1: Open “cmder” and run following command

composer global require "squizlabs/php_codesniffer=*"

This will install php code sniffer into your system.

Step 2: Now run following command into “cmder”.

composer create-project wp-coding-standards/wpcs --no-dev

This will install and register WordPeress coding standards into code sniffer.

 

Now we will integrate the code sniffer into sublime text editor. You will need package installer for that. You can install that from here

Step 3: Open Sublime Text editor and press ctrl+shft+p. You will get the textbox into editor. Type “install package” into that and press enter and wait for a while, don’t change the window.

Step 4: After a while you will again get a textbox. Type “phpcs” and you will get the result and click on “phpcs” and wait. This will install code sniffer package for sublime.

Step 5: Go to “Preferences->Package Settings->PHP Code Sniffer->Settings-Default“.

Step 6: Add “phpcs_executable_path” as shown below.

"phpcs_executable_path": "C:\\Users\\YOUR_USERNAME\\wpcs\\vendor\\bin\\phpcs.bat",

Step 7: Save the file and restart sublime.

That’s it….!!!!!!! Code sniffer is integrate with sublime.

To check if it’s working or not, open any PHP file and “right click->PHP Code Sniffer->Switch coding standards” and chose any coding standard which you want.

After that again “right click->PHP Code Sniffer->Sniff this file“. You will get some error according to your chosed coding standard.

So that’s all for now. If you have any question, then write down into comments. I will try to answer those questions.

Related Articles

The last day ( છેલ્લો દિવસ )

Hi there, The last day, yes I am talking about the last day of the year 2016. Another year passed and I became 26 in…

Install wp-cli on windows

WP-CLI is a set of command-line tools for managing WordPress installations. You can update plugins, configure multisite installs and much more, without using a web browser.

So I am going to tell you short, simple and easy way that how to use wp-cli on windows system.

Fun @ WordCamp Pune

In my previous blog First WordCamp, I covered what we have done in WordCamp. Now in this blog, you will know what fun we did…

Edit old commit message on github

Sometimes we make mistake in git commit message, especially spelling mistake. Even though I think twice before pressing the enter key after I write the…

Add custom filter for searching post or users in WordPress backend

For this, two parts are important. Part 1: Adding select dropdown Below is the action by which we can add a new search filter for…

Responses

Leave a Reply

  1. Thanks for this tutorial Bhargav. Really helpful.

    We are selecting “WordPress” as default standard at the moment.