PHP CodeSniffer with PHPStorm using WordPress Coding Standards

The WordPress Community loves PHPStorm and bolstered a little bit from our local WordPress meetup (Singapore) whereby Jack Lenox talked about CodeSniffers, Xdebug, VIP and so on, I thought it apt to show how one can get PHP CodeSniffer working on PHPStorm.

If you’re not on PHPStorm, you really should try it. Perhaps the best money I’ve spent on development software. There is a free 30-days trial 🙂

This setup is good for people who develop remotely, but people who do their development work locally can probably get most of the setup tips here too.

Installing PHP-Pear

Pear allows you to install PHP extensions easily!

sudo apt-get install update
sudo apt-get install php-pear

You may get a message to do a channel update for pear, if so feel free to run

sudo pear channel-update

Installing PHP CodeSniffer

Next, using PEAR, install PHP_CodeSniffer

sudo pear install PHP_CodeSniffer

Now you have the base PHP_CodeSniffer alongside the standard tests such as PSR2 and so on installed.

Getting WordPress Coding Standards in

Next, we shall clone WordPress Coding Standards from Github. The repo has instructions for other ways to get this working if you have a different setup than I do.

If you run into the unknown command ‘Git’ issue, or you know you do not have git installed, just run

sudo apt-get install git

I opted to install the WordPress standards alongside the other PHP standards, you can install it elsewhere but it made little sense to me not to keep things organised.

If you’re on Ubuntu 14.04 & above, PHP CodeSniffer should have been installed to the share folder. I ran

cd /usr/share/php/tests/PHP_CodeSniffer/CodeSniffer/Standards

You can now do a


and you’ll see PSR1, Squiz, PSR, Zend for example as the tests that you can run with PHPCS.

With Git installed, we can pull the repo down (wpcs being the folder name you want to use)

sudo git clone -b master wpcs

After the repo has been pulled down, we will need to add the new set of tests. WPCS offers Core, Docs, VIP, Extra tests amongst others. So we will run a command that automatically adds all those for us

sudo phpcs --config-set installed_paths /usr/share/php/tests/PHP_CodeSniffer/CodeSniffer/Standards/wpcs

To double check you can run

sudo phpcs -i

and you’ll see a bunch of new WordPress stuff added in.

Linking PHPStorm to PHP CodeSniffer

Now that you have PHPCodeSniffer installed, we can go ahead and setup PHPStorm’s link to it

Open PHPStorm and go to Default Settings. You can go to Settings if you want your changes to be project based instead of PHPStorm-wide

Inside Settings, go to ‘Language & Frameworks’ and then to ‘Code Sniffer’


You probably do not have any configuration here or a default local one. If you are developing with WAMPP or something, select local and choose the path to PHP.

However, I’m gonna go with the Remote Interpreter. Click the triple dot icon to start the setup


You will be asked to select how you want to connect to the remote interpreter. I basically connected to my Development VPS through the standard deployment configuration I already had. If you want to enter credentials instead, simply choose SSH Credentials

Next you will have to look for the PHP Executable. The path for Unbuntu 14.04 is there, simply look for it in your distro’s user/bin folder.

If you get the right file, you’ll see the correct details such as PHP Version, whether it has a debugger appear like in the picture.

Save this by clicking Ok.


Next, you will have to look for the PHPCS file, use the … browse button to look for it visual. Or if you know the path, key it in. The default path for Ubuntu 14.04 is


You can click validate and it’ll show you a tooltip telling you the version number. At point of writing, the latest stable is 2.6.1

You’re almost done! Now you have linked the CodeSniffer, you simply need to tell PHPStorm to use it during Code Inspections


Still inside Settings, go to Editor -> Inspections

Expand the PHP Tab and look for the PHP Code Sniffer Validation

Select the Coding Standard you want – if you see nothing, click on the refresh button to retrieve it from your remote interpreter.

Click Ok to save. Now you have PHP Code Sniffer working.

Let’s test it out.

Testing the PHP CodeSniffer

If you Inspect Code your file, the results will be displayed in the PHP Dropdown in the Inspection Tab.



As for inline results, check out the screenshot below


Pretty nifty eh?

If you need any help, feel free to post in the comments below

State of WordPress & Automattic

I am sure that many of you know about the hosting page change on And many of you would have been involved in spreading the news, I made sure to do so myself.

There were many requests from various parties to fix up the hosting page, after having a few of the hosts taken down. One of such requests came from the WordPress Support Team.

The background of this is that, we are not supposed to directly recommend any host beyond linking to the host page. At least not on the support forums.

But we were also wary on only recommending one host. So we got James to look into who’s managing the page.

We found out that Matt has intentions to fix up the page. But we all know that he is a busy man, and with the Support Team, we are probably one of those that actually have to link to that page on a daily basis. So I told James – why don’t we help?

And James did.

The strange thing was how this all turned out later.

The intention of James’ involvement was that he is an employee with a NDA and the survey was meant to be confidential. Could you imagine the advantage of having a database of the strengths and weaknesses of over a 100 hosts?

The hosts who submitted probably had enough confidence to do so because of the intended confidentiality. We (at needed them to be absolutely honest about what they can or cannot do, what they will or will not do.

The people looking at those results needed to be trusted, not just because they Matt trusts them or trusts them, but they needed to be bound by something beyond the relationships we build up in the community.

And in this the NDA signed by an employee was simply perfect

Matt and his team obviously saw that and jumped on it to make the hosting page better.

Yet, hours after the release, we saw this link.

The author and site owner made contact with James and I.

So enough of the background and here comes the main topic – Why are Automatticians automatically thought of as the devil?

For those that do not know, in the various teams of WordPress, we have Automatticians and volunteers. The confusing part comes from the fact that many, if not all of the Automatticians are also volunteers themselves. Most of them go beyond the simple 5 for the Future call by Matt.

The community needs to understand that whether you are an Automattician or not, the fact remains that most volunteers with has some sort of a commercial relationship with

I own a design agency that predominantly makes WordPress-based solutions. There are a few other popular ones, such as Human Made, DevriX, WebDevStudios, 10up, Yikes Inc, WooThemes (before they got bought over) and more. Yet none of these employees from such firms get as much shit as the poor people from Automattic do.

There is some prevalent misconception that Automattic controls . That could not be further from the truth.

In the Support Team, the first 2 leads were non-Automattic Employees. James was asked to be Support Rep by the previous Rep @jan_dembowski and agreed upon by the present team members at the WordPress Summit 2015. (Actually we sort of did this transition over dinner)

Out of the many team members, where I have a list here, only 2 of them are Automattic employees.

So what I really want to say is.

Stop it.

Stop giving Automattic employees a hard time just because they work for a company that makes money using WordPress.

We ALL make money using WordPress.

Today, as I’m typing this while I’m supposedly on holiday, I had the opportunity over the few hours to speak to people who contacted me over the hosting page. As always, I did my best to explain the things I knew, but I had to send people over to James as  he was more intimately involved.

Yet the same people who spoke to me with a mild, inquisitive and almost charming attitude were dismissive and entirely rude to James about the same issues discussed.

This is not the first time and I see this almost on a regular basis. And if you have been hanging around WP Tavern or other huge WordPress syndication’s comment sections, you possibly may have seen the same.

There is only so much a person can take before they say – you know what, I’m not gonna take an active part into

People have left over this, and now I’m frankly worried that James is up to his tolerance with such issues. (By the way, James has supported support forums in various capacities for nearly 12 years, many before he become an Automattician)

Yet all that he has to say today and all that he does is poisoned by the irrational notion that he’s not doing good because he is with Automattic.

James has spent 12 years of his life helping, and around 5 years in Automattic. He spends every day answering questions for Jetpack, and then answering more questions on He then has to run meetings on a weekly basis, run the entire Support Team and deal with the hate that he really should not be receiving.

When you see James, you should see –

  • 12 Years Support Veteran
  • Support Team Lead
  • General WordPress good guy

Not – Evil Automattic Employee

Stop making things hard for the kind souls who volunteering to WordPress and incidentally also work for Automattic.

The next time you decide to say something along the lines of – but you’re from Automattic, think twice.They are volunteers, most of whom spend time beyond what is required to keep WordPress going. They do not have to take shit from anyone of you, no matter how you justify your actions.

They certainly deserve as much respect as any of the other volunteers.

James is but one of the people I know that get such abuses daily.

As a closing note – remember, we all make money using WordPress in one way or another. You, and I are not better than anyone else.