Skip to main content
InterviewHubPRO
Section Overview
Q3

Question 3 of 50

Part 1: Architecture, Service Container & Request Lifecycle (1 - 10)

6%
Laravel & Ecosystem (50 Qs)•Part 1: Architecture, Service Container & Request Lifecycle (1 - 10)

What is the Laravel Request Lifecycle (`public/index.php` to HTTP Kernel)?

senior LevelMost AskedCode ExampleLifecycleDocker & ContainersSystem Design

In Simple Words: The entry-to-exit journey of a Laravel request:

  1. All traffic enters public/index.php.
  2. Composer autoloader is initialized.
  3. bootstrap/app.php initializes the Service Container and builds the HTTP Kernel.
  4. The HTTP Kernel bootstraps critical providers: Error handling, Logging, Environment (.env), Configuration files.
  5. The request passes through the Global Middleware Pipeline (Sessions, CSRF, Cookies).
  6. Routing: Matches URL, resolves route-specific middleware, executes Controller action.
  7. Controller returns a Response; middleware pipeline executes post-response tasks; sent back to client.
text
Laravel Request Lifecycle:
[HTTP Request] ──► [public/index.php] ──► [Service Container Boot]
                                                    │
                                                    ▼
[HTTP Response] ◄── [Controller Action] ◄── [Middleware Pipeline]