Blade is Laravel's built-in templating engine. It helps create dynamic views with a clear, expressive syntax. It lets you embed PHP code in HTML. Keeping the code readable and maintainable.
Blade is part of Laravel. It offers a better, developer-friendly alternative to traditional PHP templating.
Define a layout in resources/views/layouts/app.blade.php
:
<!DOCTYPE html>
<html>
<head>
<title>@yield('title')</title>
</head>
<body>
<div class="container">
@yield('content')
</div>
</body>
</html>
Then extend it in a child view:
@extends('layouts.app')
@section('title', 'Welcome Page')
@section('content')
<h1>Welcome to Laravel!</h1>
@endsection