WEB SERVER
Web server directs all the requests to the public/index.php file.
It is a starting point for loading the rest of the Laravel framework.
The index.php file loads the Composer generated autoloader definition, and
then retrieves an instance of the Laravel application from bootstrap/app.php.
HTTP / Console Kernels
Next, the incoming request is sent to either the HTTP kernel or the console kernel, depending on
the type of request that is entering the application.
These two kernels serve as the central location that all requests flow through.
The HTTP kernel is located in app/Http/Kernel.php .
Service Providers
One of the most important kernel bootstrapping actions is loading the service providers for your
application.
All of the service providers for the application are configured in the config/app.php configuration
file's providers array.
Laravel will iterate through this list of providers and instantiate each of them. After instantiating the
providers, the register method will be called on all of the providers.
Then, once all of the providers have been registered, the boot method will be called on each
provider.
Service providers are responsible for bootstrapping all of the framework's various components, such
as the database, queue, validation, and routing components.
Routing
App\Providers\RouteServiceProvider .
The above service provider loads the route files contained within user pplication's routes directory.
Once the application has been bootstrapped and all service providers have been registered,
the Request will be handed off to the router for dispatching.
The router will dispatch the request to a route or controller, as well as run any route specific
middleware.
Middleware provide a convenient mechanism for filtering or examining HTTP requests entering your
application.
For example, Laravel includes a middleware that verifies if the user of your application is
authenticated. If the user is not authenticated, the middleware will redirect the user to the login
screen.
If the request passes through all of the matched route's assigned middleware, the route or
controller method will be executed and the response returned by the route or controller method will
be sent back through the route's chain of middleware.
Finishing Up
Finally, once the response travels back through the middleware, the HTTP kernel's handle method
returns the response object and the index.php file calls the send method on the returned response.
The send method sends the response content to the user's web browser.
https://medium.com/@ankitatejani84/laravel-request-lifecycle-7c2145aa1257