This part of the tutorial continues from part 1. So, make sure your Homestead is up and running under Vagrant.

Opening the project with PHPStorm

First, open the project with PHP Storm.

File > Open Directory > Choose {PROJECT_DIRECTORY}


After opening the directory, you might want to add .idea to your .gitignore file to ignore versioning of PHPStorm configuration settings. I usually add this directory to .gitignore, but if you’re on a team, you might want to consider alternatives.

After opening the project directory in PHPStorm, it automatically configured Vagrant. So, I was able to run Vagrant commands like up, halt, destroy, etc. using PHPStorm’s Vagrant menu:

Tools > Vagrant


Configuring the Remote Interpreter

I’ll basically sum up the documentation from’s website on setting up a remote interpreter.

In PHPStorm open the PHP settings:

File > Settings > Languages & Frameworks > PHP


Click the ellipsis button (…) next to the <no interpreter> dropdown.


Click the green + button and choose the Remote option. Then, select Vagrant from the list of options. Be sure that the Vagrant Instance Folder is pointed to your root project directory. It should take a few seconds, but PHPStorm should auto-configure the rest. Click Okay.


Give this interpreter a name. I named mine Remote PHP 7. I also checked the “Visible only for this project” checkbox because I don’t want to see this interpreter for other projects. See the screenshot for my configuration.


Choose the newly setup Remote PHP 7 interpreter profile from the dropdown menu and click Apply. See screenshot for my configuration


Congratulations, the remote interpreter is now setup.

Configure Remote Debugging

The next part follows’s documentation on configuring Vagrant for debugging.

In PHPStorm, open the Web Server Debug Validation menu:

Run > Web Server Debug Validation


Choose the Local Web Server or Shared Folder radio button.

Make sure the Path to Validation Script is set to:




Set the URL to validation script the same as your local testing domain. So for mine, I used


So the next part is a little trickier. We need to modify Homestead’s xdebug configuration so that we can get the validation to work correctly. But, this requires us to SSH instead the Vagrant box and modify some settings. If you were to try and validate right now, you’d notice a several yellow notices. We need all of these yellow notices to be blue, indicating a successful validation.

SSH into the Vagrant machine using PHPStorm (or terminal/command prompt):

Tools > Start SSH Session


We’ll change into PHP’s conf.d directory:

cd /etc/php/7.0/fpm/conf.d


Now let’s edit the xdebug configuration file using vi. You can use nano or whichever shell editor you’re comfortable with.

sudo vi 20-xdebug.ini


We’re now using vi to edit the file. Press SHIFT+A and this will place the cursor at the end of the first line and it will also put vi in insert mode. Press return a couple of times to create some emtpy lines.

Add these configuration lines:

xdebug.remote_enable = 1
xdebug.remote_connect_back = 1;
xdebug.remote_port = 9000
xdebug.remote_host =


Be sure that you set xdebug.remote_host to the domain that you’ll be using. In this case, mine was

Press escape to exit insert mode.

Type :wq and then hit return. `w` stands for write (save). `q` stands for quit vi. This should have saved the file and quit vi.

** If for some reason you messed up, you can hit escape and type :q!. This will quit vi without saving changes.

See the screenshot to see what your 20-xdebug-.ini file should look like


Once you’re out of vi, you need to restart the php service. Still, using PHPStorm’s terminal editor, runthe following:

sudo service php7.0-fpm restart


Jump back to PHPStorm and test the validation. Everything should now have blue exclamation points. This is good.


Setting up a run configuration in PHPStorm

Next, we’ll setup a run configuration for our project. Open the Run/Debug configuration menu in PHPStorm:

Run > Edit Configuration


Click the Green + and choose PHP Web Application

Give this profile a name, I chose

Click the ellipsis button (…) next to Server:.

Click the Green + button.

Give this Server a name, I chose

Under host, type the domain you’re using. Again, I used as the host.

Under File directory, Be sure to set the project directory as the File/Directory and the matching path on the VM. For example: `/home/vagrant/filter-products` in my case. See the screenshot for my final server settings.


Apply those settings and hit okay.

Back at the configuration profile screen. Make sure your new server is selected as the server. Starting URL is `/`. Choose your default browser. See the screenshot for my settings.


We have now setup the run configuration for our project.

Adding and configuring XDebug Helper for Chrome

Now we’ll finally setup the PHPStorm’s XDebug helper in Chrome. This will allow us to debug our application without needing to insert the XDebug HTTP GET parameters. Our guide sums up the documentation from the official JetBrains website on setting up debugging with Chrome.

** Note that this part of the tutorial depends on chrome, but there are several versions of the XDebug Helper plugin for other browsers.

First, add the Xdebug Chrome extension: Download Link

In Chrome, Right click the bug icon and selet PHPStorm as the IDE


In PHPStorm open the PHP Debug connections menu and start listening for debug connections:

Run > Start listening for PHP Debug connections


We’ll now test the connection. Set a breakpoint somewhere in your application. I set mine in routes.php on the `return view(‘welcome’); `line. See the screenshot for an example.


You can tell there’s a breakpoint if you see the big red circle next to the line where you set the breakpoint.

In Chrome, go to your testing site (mine was

Click the bug icon and choose “Debug” so it turns green.

Refresh the page and you’ll notice your application won’t load. This is because it has hit the debug breakpoint in your routes.php file!

Go back into PHPStorm and open the Debugger tab (PHPStorm might automatically open it for you).

View > Tool Windows > Debug


You’ll now see you have all of the debugger information and actions available, such as step over, step into, etc.



Congratulations. You’ve setup PHPStorm for debugging and you’re ready to build an application.