Skip to content
Tutorials Center
My learning

Topics

Lesson 1 of 67 ยท Getting Started

What Is Laravel?

Learn what Laravel is, what a framework does for you, how Laravel 13 and PHP 8.4 fit together, and what its ecosystem (Herd, Forge, Livewire, Pest) offers.

Laravel is a free, open-source web application framework written in PHP. You use it to build websites, APIs, dashboards and online shops without writing the same plumbing again for every project. It decides where files go, how a request travels through your code, how you talk to a database, how you send mail, and how you test the result.

This tutorial teaches Laravel 13, which requires PHP 8.4 or newer. Laravel itself is not a different language. Everything you write is PHP, so if classes, namespaces and Composer still feel new, spend a little time with the PHP tutorial first. You will get much more out of Laravel when you can read its code.

What a framework gives you

A plain PHP site is a pile of files. Each file reads $_GET and $_POST, opens a database connection, prints HTML and hopes nothing was forgotten. That works for a handful of pages. It becomes painful when you need to answer questions such as:

  • Which code handles /orders/42, and how do I get the 42?
  • Where do I check that the user is logged in, for every page that needs it?
  • How do I make sure form input is validated, and the old values are shown again after an error?
  • How do I send an email without making the visitor wait?
  • How do I test all of that without a browser?

A framework answers each question once, in a consistent way, and lets you reuse the answer. The PHP frameworks lesson compares the approach in general. Laravel's answers are:

Problem Laravel feature
Mapping URLs to code Routing
Shared steps such as login checks Middleware
Building objects and wiring them together Service container
Talking to a database Query builder and Eloquent ORM
Changing the database structure safely Migrations
HTML pages Blade templates
Checking user input Validation
Slow work in the background Queues and jobs
Checking that your code works Pest or PHPUnit tests
Repeated command line chores Artisan console

You will meet every row of this table in this tutorial, in roughly that order.

The same task, with and without a framework

The best way to feel the difference is to solve one small task twice. The task: show a greeting for /hello/Ada, and answer 404 for any other address. The first version is the "plain PHP" style, where one function does everything. The second uses a tiny router. It is a stand-in written for this lesson, not Laravel's real router, but the idea is the same.

PHP One task: plain PHP versus a tiny router

Press Run (or Ctrl + Enter) to see the result here.

Program input ยท what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with fgets(STDIN)), it gets the next line from this box.

Both versions give the same answers. The difference shows up as the app grows: with the router, a new page is one more line that declares a pattern and a handler. In real Laravel you write almost the same thing:

PHP
Route::get('/hello/{name}', function (string $name) {
    return "Hello, {$name}!";
});

Laravel's route parameters, its escaping rules in views and its 404 pages are all handled for you. You will build a router like this in Routing Basics once Laravel itself is installed.

How Laravel handles a request

At a high level, every web request follows the same path. You will study each step in The Request Lifecycle; for now, keep the shape in mind.

flowchart LR
    B["Browser"] --> W["Web server"]
    W --> I["public/index.php"]
    I --> M["Middleware"]
    M --> R["Router"]
    R --> C["Controller or closure"]
    C --> V["View or JSON"]
    V --> B

Every request enters through one file, passes shared steps, and leaves as a response.

Laravel 13 and PHP 8.4

Laravel ships a new major version once a year, and each version states the PHP versions it supports. For this tutorial:

  • Use PHP 8.4 or newer. The framework relies on modern features such as typed properties, enums, readonly classes and attributes. See What's new in PHP if those words are unfamiliar.
  • Code in this tutorial uses current conventions: the slim application skeleton, bootstrap/app.php for configuration, SQLite as the default local database and Pest for tests.
  • Older tutorials may show app/Http/Kernel.php, RouteServiceProvider or the Illuminate\Foundation\Http\Kernel class. Newer versions moved most of that into bootstrap/app.php, which you will see in the next lessons.

Laravel is only as fast as you let it be, and it is not magic. A request still runs PHP code from top to bottom. Most "magic" you will read about (facades, Eloquent properties) is ordinary PHP using features such as __call, __get and reflection, and later lessons show how.

The ecosystem around Laravel

"Laravel" often means the whole family of tools, not just the framework package. The important ones are:

  • Laravel Herd: a one-click local PHP environment for macOS and Windows with PHP, Nginx and site management built in. It is the quickest way to start.
  • Laravel Sail: a Docker-based development environment for people who prefer containers.
  • Pest: a test framework with a pleasant syntax, used by default in new projects.
  • Livewire: build dynamic interfaces in PHP and Blade, with Alpine.js for small browser interactions.
  • Inertia: connect Laravel to a React or Vue front end without building a separate API.
  • Fortify, Sanctum and Passport: authentication, API tokens and OAuth.
  • Horizon and Reverb: monitor queues and run real-time WebSocket servers.
  • Scout, Cashier, Socialite and others: search, subscription billing and social login, as optional packages.
  • Forge and Laravel Cloud: deploy and manage servers or run applications on managed hosting.

You do not need most of these on day one. Part of Laravel's design is that the core is small and the extras are packages you add when you need them.

When Laravel is a good choice

Laravel suits content sites, internal tools, SaaS products, shops and APIs, especially for teams that want to move quickly with readable code. It is less suited to tiny single-purpose scripts, where a framework's startup cost buys you nothing. It is also not the only choice: Symfony, Slim and others make different trade-offs, and the frameworks lesson shows how to choose.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is Laravel?

    Laravel is a framework written in PHP. You still write PHP; the framework supplies the structure and common features.
  2. 2. Which PHP version does this tutorial's Laravel 13 require?

    Laravel 13 requires PHP 8.4 or newer. Laravel does not bundle PHP; tools such as Herd provide it for local work.
  3. 3. In the lesson's example, what did the mini router do better than the single function?

    Declaring each route as a pattern plus a handler keeps routing logic in one reusable place. Both versions escaped the name.
  4. 4. Which tool is a local PHP environment for macOS and Windows?

    Herd bundles PHP and Nginx so you can create sites locally. Horizon monitors queues, Pest runs tests and Reverb is a WebSocket server.

Summary

  • Laravel is a PHP framework: it gives you routing, middleware, a service container, Eloquent, Blade, validation, queues, testing and more in one consistent design.
  • Laravel 13 requires PHP 8.4 or newer, and you write ordinary PHP.
  • A framework replaces repeated plumbing code with shared, tested building blocks.
  • The ecosystem (Herd, Sail, Pest, Livewire, Inertia, Forge, Cloud) is optional and grows with your needs.
  • Each lesson here includes runnable plain-PHP stand-ins; real Laravel code is shown read-only.

Next: Installing Laravel and Creating a Project