PhpStorm Configuration

Enable WordPress Integration

Go to Settings > Languages & Frameworks > PHP > WordPress, enable, set installation path to ~/Code/pressbooks-dev/site/web/wp:

WordPress integration


Right click on package.json, select “Show npm Scripts”:

npm Tasks


In the Database tool window, click the plus symbol, select Data Source > MySQL:


In the SSH/SSL tab:

  • Proxy host: pressbooks.test (Port: 22)
  • Proxy user: vagrant
  • Auth type: Key pair (OpenSSH)
  • Private key file: ~/Code/pressbooks-dev/trellis/.vagrant/machines/default/virtualbox/private_key

In the General tab (Tip: Credentials are comming from the /site/.env file):

  • Host: (Port: 3306)
  • Database: pressbooks_test_development
  • User: pressbooks_test
  • Password: example_dbpassword

In the General tab for the testing database (use the same config as above for SSH/SSL):

  • Host: (Port: 3306)
  • Database: pressbooks_tests
  • User: pressbooks_test
  • Password:

Configure Remote PHP Interpreter

Settings > Languages & Frameworks > PHP > CLI Interpreter, click the three dots […], click the plus symbol, select “From Vagrant”, set “Vagrant Instance File” to the trellis directory.

PHP Interpreter


Get the Xdebug Helper Chrome plugin.

Go to Settings > Languages & Frameworks > PHP > Servers, create a new server named and map:

  • pressbooks-dev/site to /srv/www/
  • pressbooks-dev/trellis to /home/vagrant/trellis

Xdebug Setup

Enable Xdebug Helper in Chrome, set some break points in PhpStorm,enable the “Start Listening for PHP Debug Connections” telephone icon in PhpStorm, reload the website in Chrome:

Xdebug In Action

Configure Remote PHPUnit

Settings > Languages & Frameworks > PHP > PHPUnit, create a new configuration based on Remote Interpreter, set path to autoload and configuration to point to files on remote server:


Click the three dots […] next to path mappings and set pressbooks-dev/site to /srv/www/

PHP Mappings

Create and run new test configurations with “Test scope: Defined in the configuration file”

PHPUnit Running

Troubleshooting: If you have restarted your VM you will see a PHP Fatal error: require_once(): Failed opening required '/tmp/wordpress-tests-lib/includes/functions.php' Fix by re-runing bin/ (@see Unit Testing and Coding Standards)

Edit this post on GitHub.