Google News
logo
Laravel - Interview Questions
Which template engine Laravel uses?
Laravel uses Blade templating engine. Blade is a powerful but simple templating engine of Laravel. Blade allows you to use plain php code into view and it compiles and cached view until it’s modified. Blade view files are stored in resources/views directory with extension .blade.php.
 
An example of blade file is :
<!-- /resources/views/alert.blade.php -->
<div class="alert alert-danger">
   {{ $slot }}
</div>
 
In the variable $slot we can assign any value which we want to inject to component. Component looks like :
@component('alert')
   <strong>Whoops!</strong> Something went wrong!
@endcomponent
@component is the blade directive here.
Advertisement