How do you debug with blade and sage 9?



Hi all. I’m really new to templating. How do you correctly debug blade? All I get is a reference to the compiled file. What is your workflow for this? I’ve been looking through the best practice thread but still cant wrap my head around how to debug.


I just ran into this issue as well. Digging into it a little more now, if I figure something out I’ll post it back, otherwise if anyone has some advice on this it would be greatly appreciated.


Use whoops

There is a WordPress implementation here. Just make sure you don’t accidentally leave WP_DEBUG enabled on a live site, it dumps your environmental variables on the debug screen thus dumping your database credentials.

Otherwise, it should easily solve the headache of debugging.


Are you using wps? I get a fatal error on activation.


You need to composer install in its directory if you didn’t use composer create-project


Gotcha. Will give it a whirl later!


You can also use it as a theme dependency other than a wp-plugin



WPS may need some quality of life updates. It appears to be breaking my AJAX in the backend.


This might be helpful -


FWIW, the link above is working for me. Dropping @php(xdebug_break) into a Blade template kicks off the debugger for me.

It’s a little weird because you end up stepping through the compiled PHP file, but all the variables are accessible. Regardless it seems like most of the debug action is probably going to take place in the controller anyway.


I installed Whoops directly as a require-dev in composer.json.

"require-dev": {
    "filp/whoops": "^2.1",

Then registered it in my setup.php file.

function registerWhoops() {
    $whoops = new \Whoops\Run;
    $whoops->pushHandler(new \Whoops\Handler\PrettyPageHandler);
if( WP_DEBUG ) registerWhoops();