How request is handled in laravel
When request to laravel application is made ,that requests are directed to public/index.php directed by web server.Then index.php loads composer generated autoloader definition,and then instance of laravel application is retrieved from bootstrap/app.php
HTTP / Console Kernels
Once we get instance of application,incoming request is sent to HTTP kernel or console kernel ,depending upon type of request. HTTP kernel is located inapp/Http/Kernel.php.
The HTTP kernel extends the Illuminate\Foundation\Http\Kernel class, which defines an array ofbootstrappers that will be run before the request is executed. These bootstrappers configure error handling, configure logging, detect the application environment, and perform other tasks that need to be done before the request is actually handled.
The HTTP kernel also defines a list of HTTP middleware that all requests must pass through before being handled by the application. These middleware handle reading and writing the HTTP session, determine if the application is in maintenance mode, verifying the CSRF token, and more.
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.phpconfiguration file's providers array. First, the register method will be called on all providers, then, once all providers have been registered, the boot method will be called. Dispatch Request