Laravel Tutorial · Laravel Basics · Lesson 1 of 27

Laravel Introduction

What Laravel is, why it's the most popular PHP framework, and what a Laravel route looks like.

Create a free account to save this page, take notes and track your progress. Sign in

What is Laravel?

Laravel is a PHP web framework for building websites, APIs and full applications. It gives you a clean structure and well-designed tools for the jobs every app has:

  • Routing: map URLs to code.
  • Blade: templates for HTML pages.
  • Eloquent: work with database tables as PHP objects.
  • Validation, authentication, queues, caching, mail, events, testing and more, built in.
  • Artisan: a command-line tool that generates code and runs tasks.

It's the most widely used PHP framework, with a big ecosystem: Livewire and Inertia for interactive front ends, Sanctum for API tokens, Horizon for queues, and hosting tools like Forge and Vapor.

A first route

Your first routes
<?php
use Illuminate\Support\Facades\Route;

Route::get('/', fn () => 'Hello, Laravel!');
Route::get('/about', fn () => ['app' => config('app.name'), 'framework' => 'Laravel '.app()->version()]);

visit('GET', '/');
visit('GET', '/about');

Output

GET / -> 200 Hello, Laravel!
GET /about -> 200 {"app":"Laravel","framework":"Laravel 13.38.0"}

Run this on your computer — see “Get Started” for setup.

A route connects an HTTP method and URL to the code that answers it. This tutorial's examples are complete scripts: they define routes, then use a small visit() helper that sends a request through Laravel and prints the status code and response, exactly what Laravel's own HTTP tests do. In a real project, routes live in routes/web.php (pages) and routes/api.php (APIs).

All examples are run with Laravel 13 on PHP 8.3.

Test yourself

What does a Laravel route do?

  1. Defines a database table
  2. Maps an HTTP method and URL to the code that handles it
  3. Compiles PHP to HTML
  4. Starts the web server
Show answer

Answer: Maps an HTTP method and URL to the code that handles it

Was this page helpful?