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

ringo's avatar
Level 1

How to return html file as view?

Hi, I am making a single page application with anguarjs. While blade and angular both use double curly brace({{,}}) as interpolation, I decide not to use blade, and just return html file with angular code in it. But when i use view(index), it only recognizes php file, not html file. Is there any way to make 'view' returns files with html extension?

0 likes
8 replies
JackJones's avatar

All you need to do for blade to ignore the braces is:

@{{ data }}
1 like
ringo's avatar
Level 1

@JackJones Yes we can use escape, but I just want to return static html page. Because in my single page application, i barely uses blade template. Most are done with ajax and angular.

JackJones's avatar

Just create the html file and upload it?

You have a static html file, so where exactly does Laravel come into play?

Cronix's avatar

just name the html file with a php extension

ringo's avatar
Level 1

@JackJones Laravel comes in to play when routing. My static html file resides in public/sites folder, and I like to route request to / to my html file.

ringo's avatar
Level 1

@Cronix If file has php extension, blade will interpolate it, and so all angular braces will be corrupted. Using @ with php will prevent it, but I am trying to return static html, since My project has no use of blade tempting.

Cronix's avatar
Cronix
Best Answer
Level 67

@ringo No, blade will interpret it only if it has a .blade.php extension, not just a .php extension. You can have a php file with NO php in it and ONLY html. Just don't have any php tags in it if you don't want any php to be interpreted.

You could name them like yourfile.html.php just to make it more clear in your view directory which are the html-only files. Then just load them like normal views like you're wanting. This will just get around laravel only loading view files with the php extension. It doesn't mean it has to actually contain php.

1 like

Please or to participate in this conversation.