# Laravel Blade Templates: Writing HTML the Smart Way
## Introduction
Blade is Laravel's template engine. Think of it like a smart notebook that lets you write HTML mixed with small PHP snippets, but cleaner.
## What is Blade?
Blade files use the `.blade.php` extension. They live in `resources/views/`. Laravel compiles them to plain PHP behind the scenes.
## Your First Blade View
Create `resources/views/hello.blade.php`:
Hello, {{ $name }}!
The `{{ }}` syntax safely prints a variable (auto-escaped). ## Passing Data from a Route Route::get('/hello/{name}', function ($name) { return view('hello', ['name' => $name]); }); ## If / Else in Blade @if($age >= 18)You are an adult.
@elseYou are a minor.
@endif ## Loops in Blade-
@foreach($fruits as $fruit)
- {{ $fruit }} @endforeach