Laravel Request Lifecycle

Browser Request (http://my-app.test)
  ↓
public/index.php
  ↓
bootstrap/app.php
  ↓
Service Providers (config/*.php)
  ↓
Routes(web.php/api.php) → Middleware → Controller
  ↓
Response
  ↓
Browser


  • Every request to your Laravel app starts at public/index.php.
  • It boots the Laravel framework using bootstrap/app.php and load routes(web.php,api.php).
  • Creates the application instance. so loads service providers from config/*.php
  • Routes are defined in:
  • routes/web.php (for web requests)
  • routes/api.php (for API requests)
  • Before hitting the controller, Laravel passes the request through middleware stack.
  • If a controller or closure is matched laravel executes the method.
  • Whatever the route/controller returns (string, view(), json()) is wrapped into a Illuminate\Http\Response object.
  • The request lifecycle ends.



Whereisstuff is simple learing platform for beginer to advance level to improve there skills in technologies.we will provide all material free of cost.you can write a code in runkit workspace and we provide some extrac features also, you agree to have read and accepted our terms of use, cookie and privacy policy.
© Copyright 2024 www.whereisstuff.com. All rights reserved. Developed by whereisstuff Tech.