PHPstorm - Unable to set breakpoints in blade.php files

Don F picture Don F · Feb 13, 2015 · Viewed 12k times · Source

I'm working on a Laravel application and can debug my controller php files fine, but Id like to also debug the blade.php files. With my current setup Ive followed all of jetbrains recommend settings for Laravel, (https://confluence.jetbrains.com/display/PhpStorm/Laravel+Development+using+PhpStorm#LaravelDevelopmentusingPhpStorm-DebuggingLaravelApplicationswithPhpStorm) but it is still not allowing my to set breakpoints in the blade.php files.

What could I be missing?

Answer

Alex picture Alex · Oct 3, 2015

Putting a

<?php xdebug_break(); ?>

into your blade file works pretty well. Even in my tests, PHPstorm jumps to the next PHP statement in some cases.

Why this works:

Laravel processes the blade file to a normal PHP file in the cache folder. But the PHP statement xdebug_break(); will be transferred there and cause the program to halt at the position you want it to (in the cache file).