Laravel: Blade Template Debugging

When debugging blade templates in Laravel 5.* you often get meaningless error messages pointing to cached views. Everything used to be better: the debugging view in version 4 contained more helpful functions and was also visually more attractive. With a few lines of code you can get this functionality back with the help of 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