Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Cerbix's avatar

Display double curly braces as raw text in blade?

My website generates some scripts that contains code that users can copy and paste into their website.

Unfortunately the code generated for users happens to also use double curly braces in it, which of course conflicts with Laravel/Blade, and then Laravel tries to render it as a variable, which then doesn't exist and throws an error, or returns a blank page.

Is there a way to display {{ }} as raw text? I've also tried HTML entities like & # 123; and & # 125;

But laravel still assumes I'm trying to pull in a variable, instead of just displaying it as text.

Any solutions for this? Thanks

0 likes
4 replies
Nakov's avatar

@cerbix you can escape curly braces by prefixing them with @.

@{{ 
Cerbix's avatar

See, I saw that in my searches online.

But whenever I use @{{ }} the curly braces are invisible/don't display.

If I use like @{{ test }} the blade only loads a blank screen. same with @{{ $test }}

I don't seem to get any sort of error, it just breaks the blade template.

Any idea?

Snapey's avatar
Snapey
Best Answer
Level 122

Double braces passed to the client will also be interpreted by vue if you also have this loaded

Either disable vue altogether or tell it to ignore the braces with v-pre

https://vuejs.org/v2/api/#v-pre

Cerbix's avatar

That was it, the @{{ wasn't working because VUE was also interfering with it. Using v-pre along side @{{ resolved the issue.

Thanks!

Please or to participate in this conversation.