Phpstorm Wordpress



  1. Phpstorm Wordpress Development
  2. Phpstorm Wordpress Configuration
  3. Phpstorm Wordpress
  4. Phpstorm Wordpress Tutorial
  5. Phpstorm Wordpress Debug
Phpstorm wordpress configuration
  1. Andy Meerwaldt is an ambitious web developer at Yoast. In his spare time he loves to read about both World Wars. A nice way to optimize your test flow is by having PhpStorm run your unit tests for you. It can be quite some work to set this up for WordPress plugins, since they depend so heavily on WordPress.
  2. While PhpStorm has a start (green ‘play’ icon) button for console and linear web applications, it is awkward when using XDebug and WordPress; especially when dealing with permalink structures.

This video is a part of JetBrains PhpStorm Video Tutorials by JetBrains Technical Evangelist Maarten Balliauw.Check out to fin. Overview JetBrains PhpStorm is a commercial PHP IDE that can be configured to work with WordPress sites, allowing users to easily build and maintain custom plugins. This doc will set you up with a local environment in PhpStorm to create your custom plugins and themes. For detailed information, see WordPress Development using PhpStorm.

While working with WordPress after a while, the first problem I encountered is that I can’t debug it easily as I could do it directly from PyCharm (for python/django), RubyMine (for ruby/rails). So, I wanted to figure out how to do it in phpStorm for WordPress. I found it is quite easy to get it done with a few easy to follow steps.

phpStorm 8 (currently available in EAP) has support for WordPress development. Follow the official doc to configure phpStorm for WordPress.

Enable Remote Debugging using xdebug

Check the official document on how to install xdebug extension for PHP and enable it. Once the extension is installed, you need to enable it and also enable remote debugging.

[xdebug]
zend_extension='/Applications/MAMP/bin/php/php5.5.10/lib/php/extensions/no-debug-non-zts-20121212/xdebug.so'
xdebug.remote_enable=1

Phpstorm Wordpress Development

The above is my configuration. However, you may need to change the path of xdebug.so based on your extensions path.

Once installed, restart your web server. To make sure xdebug is activated, run

This should output something like:

$ php -v
PHP 5.5.10 (cli) (built: Apr 10 2014 17:49:22)
Copyright (c) 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies
with Xdebug v2.2.4, Copyright (c) 2002-2014, by Derick Rethans

Notice that Xdebug 2.2.4 is activated. You can also see this using phpinfo().

Configuring phpStorm

As we’ve installed Xdebug, let’s link it with phpStorm. Open phpStorm’s preference and

Select version from PHP language level and interpreter where you’ve just configured the xdebug. If it’s not listed, click on the button.

Phpstorm wordpress debug

Give your interpreter a name. For PHP home, click the button next to the field and locate your php interpreter. If you don’t know where it is go to your shell and run the following command to get the location.

It should detect that Xdebug is installed in this interpreter. Press Ok buttons.

Now, you need to tell phpStorm to listen for the Debug connections. In the toolbar, you will notice the button shown in the following screenshot. Click there and phpStorm will start listening for debugger connections.

Phpstorm Wordpress Configuration

Triggering the debugger

We’re in the last part of our configuration. Everything is done except triggering the xdebug. There are several ways of triggering the debugger. Easiest way is probably using browser extensions. Install extension for your browser as listed below. I will show for Chrome.

After installing the extension, you’ll notice a new button at the right side of your address bar.

Phpstorm Wordpress

Click on it and choose Debug option.

That’s all*. Now set a breakpoint in your IDE and the execution will be paused there when you refresh your page.

Phpstorm Wordpress Tutorial

You can now step into different levels, evaluate expressions on current context, see all scope variables and so on. Your WordPress development will never be painful like earlier. Follow this link to learn more about debug toolbar.

Wordpress

Phpstorm Wordpress Debug

* First time, you will receive a prompt in your IDE to accept the incoming connection.