Laravel for Beginners – Learn to Build Full-Stack Web Apps

Loading video...

Request Lifecycle

Getting Started With Laravel

Request Lifecycle

Untitled

In Laravel the request starts on public/index.php. index.php includes vedor/autoload.php file, then it creates application in bootstrap/app.php. The application itself loads configuration files and initiates service providers.

Service providers in Laravel prepare and configure the application, handling tasks like registering services, event listeners, middleware, and routes. They ensure both core and custom features are set up correctly, making the application ready to function efficiently.

Then the request is passed to Router.

The Router takes the request, finds the corresponding function to execute and executes that. Optionally there might be middleware registered on the route. We will talk more about middlewares, but in a nutshell the purpose of the middleware is to execute code before the request reaches to the action and possible block the code. After this the controller will send the response back to the user, or if the middleware is registered, the response will be passed to middleware first and then returned to user.

Discussion

Sign in to join the discussion.

No comments yet. Be the first to start the discussion!