Laravel: Blade Template Debugging

When debugging Blade templates in Laravel 5.*, you often get unhelpful error messages that refer to cached views. Things were better in the past: The debugging view in version 4 offered more helpful features and was also visually appealing. With just a few lines of code, you can restore this functionality using whoops ("PHP errors for cool kids").


An exemplary error view looks like this in Laravel 5.4:

Laravel: Blade Template Debugging

First you include the package "filp / whoops" in the dev block of composer.json:

b29e71797fcd218306e15ef463ee9cba

Then you modify the rendering method, which is responsible for sending the exception to the browser:

b29e71797fcd218306e15ef463ee9cba

Now you get the full code preview and other nice features like current environment variables:

Laravel: Blade Template Debugging

Back