Using PHP CodeSniffer is one of those tools that is part of my workflow that I find utterly invaluable. I haven’t always used it, though.

Don’t get me wrong: If you’ve read this blog for any length of time, you know I’m big on Coding Standards. But when it came to the PHP CodeSniffer, there was an extended period I had gone before I installed it.

Why, though?

Simply put, it was because I didn’t know it existed, at least not for WordPress. When I discovered there was a ruleset for WordPress (and WordPress VIP), it became something that I believe should be a necessary tool in every WordPress developer’s toolbox.

Depending on your IDE, you may or may not be able to install a plugin or an extension that will automatically monitor your code while you’re writing.

I made the change to Atom some time ago, which I’ll share more about momentarily, and it has excellent support for incorporating PHP CodeSniffer into your workflow.

Using PHP CodeSniffer with Atom and WordPress

At first, I was planning to write a much longer post about how I’ve swapped IDEs from Coda to Atom, but I figured that was content for another post. Plus, it ended up dragging on longer than I wanted.

Suffice it to say that I’m no longer using Coda and after a bit of a prompting from Ryan Fugate, I opted to give Atom a third look. It’s matured a lot since I last tried it.


It’s what I’ve been using for the last few months now, and I dig it. I’ve got a whole list of packages I could share (and eventually will).

For now, though, I find that using PHP CodeSniffer with the WordPress ruleset is essential in writing quality WordPress code.

Using PHP CodeSniffer - An Atom Package

So if you’re using Atom, here’s how to set it up. I’m assuming that you’re using MAMP, but it doesn’t matter as long as you know the path to your PHP CodeSniffer installation.

  1. Install PHP CodeSniffer using Pear or Composer.
  2. Install the WordPress ruleset for the PHP CodeSniffer.
  3. Download a copy of the Linter PHPCS package.
  4. In Atom, specify the executable path to the PHPCS binary.
  5. In Atom, define the set of rules you want to apply when it’s evaluating your code.

Here’s a screenshot of what my configuration looks like:

Using PHP CodeSniffer with Atom - My Configuration

My configuration for using PHP CodeSniffer with WordPress and Atom.

Easy enough, right? Only specify the executable to your installation of phpcs then set the rules for which you want to evaluate your code, and you’ll be good to go.

If you’re looking for another developer’s experience with this setup, also check out what Jason Resnick has shared on his blog regarding using PHP CodeSniffer with Atom. His approach varies a little from mine and it’s always good to see how others tackle similar problems.