Escaping Data in Laravel Blade Files

Chris Sevilleja


t's always good practice to escape data when displaying it to our users. This is very simple to do in Laravel since they provide great tools to display data.

Normally, you can use the double curly braces ({{ $variable }}) to display data. However, this does not escape data.

Don't worry though, Laravel provides a very easy way to do this without changing your code drastically. Introducing the triple curly brace!

Escaping Data with 3 Curly Braces

// escaped 
{{{ $variable }}}

// not escaped
{{ $variable }}

Just like that, we have an application/site that is that much safer.

Chris Sevilleja

Co-founder of Slapping the keyboard until something good happens.