What is Blade templating engine in Laravel?

Laravel is an MVCModel-View-Controller framework while Blade is what enhances or handles the default View. Blade is a capable templating engine that’s included with Laravel.

In comparison to other PHP templating engines, Blade does not prevent you from utilizing plain PHP code in your code. In reality, all Blade layouts are compiled into plain PHP code and cached until they are altered. This means that Blade includes essentially zero lag to your application.

Blade layout files utilize the .blade.php file extension and can be found within the resources/views folder.

Data can be passed from the routes or controller depending on the nature of your logic or application. The controller and routes can return the view i.e., the .blade.php

From the route we would return the greeting.blade.php like this:

Route::get('/', function () {
    return view('greeting', ['name' => 'Finn']);
});

Click here to read about how to pass data to the view i.e., the blade, using the compact() methodan easier way to pass data to the view.

Free Resources