A thorough walkthrough of the Laravel HTTP request lifecycle, tracing every step from the web server hitting public/index.php through Composer autoloading, application bootstrapping, service provider registration and booting, global middleware, routing, route middleware, route model binding, controller execution, response normalization, outbound middleware, response sending, and kernel termination. Includes practical code examples for each phase, clarifies common misconceptions (e.g., controllers are not the start of the request, route model binding happens in middleware), covers terminable middleware, and explains how long-running workers like Laravel Octane change state management assumptions. Ends with a 25-step end-to-end trace and a debugging checklist organized by lifecycle phase.

20m read timeFrom wendelladriel.com
Post cover image
Table of contents
IntroductionThe Big PictureThe Web Server Does Not Run Your ControllerBuilding the ApplicationCapturing the RequestThe HTTP KernelBootstrapping the FrameworkService Providers Are the Bootstrap LayerSending the Request Through the Global Middleware StackMiddleware Is an OnionThe Router Finds the Matching RouteRoute Middleware Runs Before the ControllerRunning the Route ActionPreparing the ResponseThe Response Travels Back OutSending the ResponseTermination Happens After the Response Is SentWhat Changes in Long-Running WorkersCommon Lifecycle MisunderstandingsA Practical Debugging ChecklistThe Full Flow in One ExampleConclusion
3 Comments

Sort: