Laravel

Understanding the Laravel Request Lifecycle

The Code Hub Admin
Sep 23, 2026
8 min read

Trace an incoming HTTP request through public/index.php, service container bootstrap, HTTP kernel, middleware pipeline, routing, and controller execution.

The Entry Point: public/index.php

Every HTTP request entering a modern Laravel application starts at public/index.php. This tiny file acts as the front controller. It performs three critical operations:

  1. Loads Composer's auto-generated autoloader.
  2. Retrieves an instance of the Laravel application kernel from bootstrap/app.php.
  3. Handles the incoming HTTP request and sends the prepared response back to the client browser.
Plain text
HTTP Request
     │
     ▼
public/index.php
     │
     ▼
bootstrap/app.php (Service Container Setup)
     │
     ▼
HTTP Kernel & Global Middleware
     │
     ▼
Route Matching & Route Middleware
     │
     ▼
Controller / Action / Closure
     │
     ▼
HTTP Response returned through Middleware pipeline

Service Container Bootstrapping

Before your route or controller runs, Laravel bootstraps core services registered across service providers. These configure database connections, encryption, session stores, view engines, and logging.

Middleware Pipeline

Laravel pipes the request through an onion-style series of middleware (e.g. EncryptCookies, VerifyCsrfToken, SubstituteBindings). If any middleware halts the pipeline or redirects, subsequent layers and the target controller never execute.

Response Delivery

Once the controller returns an Inertia response, JSON payload, or RedirectResponse, the response travels backward through the middleware pipeline (allowing headers or cookies to be attached) before being dispatched over the wire via FastCGI or PHP-FPM.

Topics in this article

Related Knowledge Articles

A practical walkthrough of configuring React 19 with Inertia v3, typed Wayfinder actions, and Tailwind CSS v4.