Laravel Blade Templating

Blade is a simple, yet powerful templating engine provided with Laravel. Blade is driven by template inheritance and sections. All Blade templates should use the .blade.php extension.

In general core php coding you may have practice of separating the header, body and footer section of your webpage in separate files.

Then we used to include the files in our webpage like in following example.


Well laravel makes it more easier. Lets see how we can do it.

Step 1: Create a folder layouts in views directory.

Step 2: In that we create a file default.blade.php.

default template file
default template file

Here is the code of this file


We have now created a template file. Now we can use this template in our view files. Lets see how.

Step 3: Now to use the template simply write the code in your view files like this.

In our default template file we wrote @yield(“content”). So whatever we want to write in our content area we will write it using


//your html content here


So you see, How easy and clear is this?

Now we need to know about the laravel blade html syntax.

Share this article: