Originally published on laravel.learnio.dev — part of the Laravel best practices course. View this lesson on the original site.
How a request moves through Laravel
When you open a page in Laravel, the framework runs a fixed sequence. Learning each stage gives you a reliable debugging map.
Lifecycle at a practical level
- Request enters
public/index.php. - Application boots from
bootstrap/app.php. - HTTP kernel runs bootstrapping steps.
- Service providers are registered and booted.
- Router matches the request to a route.
- Route middleware pipeline runs.
- Controller/closure executes.
- Response travels back through middleware and is sent.
flowchart LR
A[Browser request] --> B[public/index.php]
B --> C[bootstrap/app.php]
C --> D[HTTP kernel]
D --> E[Service providers]
E --> F[Router]
F --> G[Route middleware]
G --> H[Controller or route action]
H --> I[Response]
1) Entry point: public/index.php
This is the single front controller for HTTP requests. Your web server points traffic here, not to random files in the project.
flowchart LR
A[Browser request] --> B[public/index.php]
2) Application bootstrap: bootstrap/app.php
Laravel builds the application instance and container, which everything else depends on.
flowchart LR
A[public/index.php] --> B[bootstrap/app.php]
B --> C[Application instance]
3) HTTP kernel
The HTTP kernel runs core bootstrap tasks and starts the request pipeline.
flowchart LR
A[Application instance] --> B[HTTP kernel]
B --> C[Bootstrap tasks]
4) Service providers
Providers register and boot major framework features (database, validation, routing, and more).
flowchart LR
A[HTTP kernel] --> B[Load providers]
B --> C[Register]
C --> D[Boot]
5) Router
The router matches method + path to a route definition and chosen handler.
flowchart LR
A[Request method + path] --> B[Router match]
B --> C[Route action selected]
6) Route middleware pipeline
Route middleware runs before and after your handler as needed (auth, throttle, etc.).
flowchart LR
A[Matched route] --> B[Middleware 1]
B --> C[Middleware 2]
C --> D[Handler]
7) Controller or route action
Laravel resolves dependencies, then executes your controller method or route closure.
flowchart LR
A[Resolved dependencies] --> B[Controller action]
B --> C[Response object]
8) Response return path
The response travels back through the outbound middleware path and is sent to the browser.
flowchart LR
A[Response object] --> B[Outbound middleware]
B --> C[Send to browser]
Why this stage map matters
This model tells you where to look when behavior is wrong:
- route not found: check route registration and method/path,
- access denied unexpectedly: check middleware and auth state,
- wrong output: check controller/action and response construction,
- config mismatch: check environment and provider boot logic.
Practical checkpoint
Pick one route in your app and trace it through all eight stages once.
If you cannot place the failure stage, you will usually patch symptoms instead of fixing root cause.
From Laravel best practices — What is Laravel?