Regarding my development environment, this is the first year that I’ve made drastic changes to my toolset in several years (once I find things I really like, I tend to stick with them).

Atom Packages for WordPress

Case in point, in the last few months alone:

And with these changes come some other necessary configuration changes. Specifically, I still use PHP CodeSniffer but, out of necessity, its setup and configuration have changed.

PHP CodeSniffer with Pressmatic and Atom

Assuming that you’re using PHP CodeSniffer with Pressmatic and Atom, the following steps will walk you through what you need to do to update your environment’s configuration.

1. Install Composer

Before you install PHP CodeSniffer, make sure that you have Composer installed.

Installing PHP CodeSniffer with Pressmatic and Atom

Ideally, it should be available globally on your system. To do this:

  1. Download the installer
  2. Open Terminal and navigate to the directory where you downloaded the script
  3. Next, run $ php installer on the command-line.
  4. Finally, run $ mv composer.phar /usr/local/bin/composer and this will move Composer to a globally accessible location on your [OS X-based] machine.

If it’s not globally available, I assume that you’re ready to go with running it from wherever you have it installed.

2. Install WPCS and PHP CodeSniffer

If you focus specifically focused on WordPress development, then you can install both PHP CodeSniffer and the WordPress rules for the WordPress Coding Standards in a single command.

PHP Coding Standards

Note that you should be in the directory that you wish to install the Coding Standards. The next step will install everything into the directory out of which you’re working.

From the terminal, enter the following command:

  • $ composer create-project wp-coding-standards/wpcs:dev-master --no-dev

This will install the WordPress Coding Standards into the directory out of which you’re working, will install PHP CodeSniffer, define the rule set for the WordPress Coding Standards, and make the PHP CodeSniffer executable globally accessible.

3. Configuring Atom


Once you have the previous steps completed, note where you’ve installed the WordPress Coding Standards package.

  1. Open Atom and navigate to the PHP Linter settings screen. This should be accessible via the Atom, Packages, linter-phpcs configuration page.
  2. In the Executable Path text input, place the directory to the phpcs executable. In my case, I defined: /Users/tommcfarlin/Dropbox/Projects/wpcs/vendor/bin/phpcs.
  3. In the Code Standard Or Config File page, you can define the rules to use. Here, you can use WordPress or WordPress-VIP or whichever set of rules you prefer.

At this point, you’re all set up to start using PHP CodeSniffer with Pressmatic and Atom.

What About Debugging?

If you’ve read any of my previous posts about WordPress development, then you know I’m a big fan of using a debugger (over printing out the value of variables to the screen).

And if you’ve swapped over to Pressmatic and are wondering how to configure the environment to use Xdebug, then see my previous post, too.