Setup PHPstorm for wordpress development

phpstorm icon

Setup ideas are taken from here.

Benefits of PhpStorm

PhpStorm is packed with productive and automated workflow features that will save you a ton of time, frustrations, and money. For example:

  • Increases productivity
  • Lighting fast nativation
  • Intelligent coding help, with php, wordpress, javascript 
  • Use WordPress Coding Standard linter to conform with standards.
  • The refactoring tools automate refactoring processes.
  • Define where the phpcs.xml.dist file is in your project, to automatically alert you to violations as you are writing and testing your code.  Not Done yet.
  • Terminal is built right in – great for git commands, gulp, and lighthouse, and auto deployment.  
  • Debugging tools are baked into it too.
  • PHP, WordPress, JavaScript, etc. autocompletions and hints help you to know what arguments you need to define.

The Look

Everyone has different preferences to the look, however these are the options I like:

  • Open the Preferences ( Command , )
  • Change the scheme from “Default” To Darcula
  • Change schema to larvel: Open file, then click page download save as lravel.icls in file format all files (not text).
  • Adjust the Font to “Source Code Pro”, Font Size to 15, and Line Spacing to 1.5
  • Adjust Comments Colors to 629599 – In Block Comments, Doc Comments, and Line Comments
  • The recommended look is:  Preference 
  • Additional Options: Themes


Enable WordPress & Jump to Hook

With the preference enable WordPress within phpstorm (as seen in picture), then you will have the options to

  • Jump to where a hook (event) is being fired. As show in the image
  • Autocompletes for hook names.
  • Filtering lookup for hooks.

WordPress Coding Standard

When wordpress coding standard is enabled in PhpStorm  you can use the linter to compile the standard simply by pressing Option Command L. 

Enable WordPress Linter (Coding Standards) in PHP Storm

Customize Function DocBlock Template

With in the options as seen below the standard block we use is. 

 * Describe the expected behaviour
 * @since 1.0.0
 * @author
 * @return ${TYPE_HINT}


Location to adjust the function comment block
Sample of comments generated