PHP Storm isn’t free, the learning curve is a little steep, and configuration can be difficult. But that first time you click ⌥ + ⌘ + L
and watch all of your =>
line up underneath each other like little soldiers, or hover over a hook and type ⌘ + B
and get whisked to the original function declaration in the WordPress Core, or generate custom doc blocks, or type forek
and it generates all the syntax for a foreach
loop …. ???? + ????!
Below is my attempt to walk you through the setup so that you can start leveraging this powerful IDE to build WordPress sites with ease. Here’s are the steps:
In terminal
1. Install PHP Code Sniffer globally with Composer
Assuming you already have Composer installed, run the following from the command line :
composer global require "squizlabs/php_codesniffer=*"
2. Add the path to your $PATH variable so terminal can find it
Open your .bash_profile or .zshrc file and add the following so that terminal can find the global path:
export PATH="$HOME/.composer/vendor/bin:$PATH"
$ which phpcs
check the path to see if it was successfully installed:
which should return:
$ /Users/[yourname]/.composer/vendor/bin/phpcs
3. Download the WordPress Coding Standards to a new directory (below I created an empty directory called wpcs)
$ git clone [email protected]:WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs
4. Add the WPCS to PHPCS
$ phpcs --config-set installed_paths /Users/[yourname]/wpcs
In PHP Storm
- Navigate to: Preferences (⌘,) > Languages & Frameworks > PHP > Frameworks
- Check Enable WordPress Integration
- Set the path to your Public folder (or whatever root directory that contains your entire WordPress installation)

4. Click Validate + OK
Add the phpcs executable file path
- Navigate to: Preferences (⌘,) > Languages & Frameworks > PHP > Quality Tools > Code Sniffer

2. Click on the … to bring up the path field and add the path to your file

3. Click Validate + OK
Choose the WordPress Coding Standards from the Coding Standard Drop-down
- Navigate to: Preferences (⌘,) > Editor > Inspections > PHP > Quality Tools > PHP
- Click/check Code Sniffer Validation
- Hit the refresh button in the Coding Standards drop down

4. Choose a WordPress coding standard from the drop-down

5. Repeat steps for Default so you have the above set-up going forward
