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

zhanang19's avatar

Compile blade view syntax to HTML

Is there a good way to get compiled HTML string from blade syntax? I have to try Blade::compileString(), but it compile blade to raw PHP.

0 likes
3 replies
MichalOravec's avatar

With render you get html of your blade file.

$html = view('your-blade-file', compact('yourVariables'))->render();
zhanang19's avatar

How about it's just a single line blade syntax? (without creating a blade file)

Example: Render Laravel 7 Component to a HTML string.

Please or to participate in this conversation.