agyanadda@gmail.com

Laravel Introduction

Laravel Basics 1 min read Updated Dec 2, 2026 Topic 1 of 31

Laravel is a free, open-source PHP framework for building web applications. A framework gives you a ready structure and tools, so you do not write routing, database code, login and security from scratch every time.

Why use Laravel?

  • Clean routing — map URLs to code in one line
  • Eloquent ORM — work with database tables as PHP objects
  • Blade templates — simple, fast HTML views
  • Built-in security — CSRF protection, password hashing, escaping output
  • Artisan — a command-line tool that generates code for you
  • Huge ecosystem — Breeze, Sanctum, queues, mail, testing

The MVC pattern

Laravel follows Model–View–Controller:

  1. Model — talks to the database (e.g. Post)
  2. View — the HTML the user sees (Blade files)
  3. Controller — receives the request, uses models and returns a view

What you need to know first

Basic PHP (variables, arrays, functions, classes), HTML and a little SQL. If you are new to PHP, finish the PHP tutorial first.

Example

Example — A complete Laravel page in one route PHP
<?php
// routes/web.php
use Illuminate\Support\Facades\Route;

Route::get('/hello', function () {
    return 'Hello from Laravel!';
});

Open http://127.0.0.1:8000/hello and the browser shows: Hello from Laravel! One line maps a URL to the code that answers it.

Test Yourself With Exercises

Exercise 1 Multiple Choice

What is Laravel?

Exercise 2 True / False

In MVC, the Model is responsible for talking to the database.

Exercise 3 Fill in the Blank

Laravel's command-line tool is called ___.

Frequently Asked Questions

Yes. Laravel is written in PHP, and its code uses classes, arrays, functions and namespaces all the time. Knowing core PHP makes Laravel much easier to understand and debug.