Request Lifecycle in Laravel
Request Lifecycle in Laravel
Laravel
How things flow in a Laravel app?
“you feel more confident if you
understand how that tool works”
lifecycle
a sequence of events and actions that
occur during the execution of a request.
Each request goes through several stages,
and Laravel provides various mechanisms
to perform actions at different points in
this lifecycle
Do you know?
The first-ever website, created by Tim
Berners-Lee, went live on August 6, 1991.
It was a simple page describing the World
Wide Web project and how to use
hypertext to access documents.
Index.php – The ENTRY point
• a) Kernel
• b) Router
• c) Controller
• d) View
Which of the following is responsible for
processing HTTP middleware in Laravel?
• a) Kernel
• b) Router
• c) Controller
• d) View
The correct answer is a) Kernel. The
Kernel class in Laravel is responsible
for processing HTTP middleware,
which includes actions like verifying
authentication, etc.
The HTTP kernel extends the Illuminate\
Foundation\Http\Kernel class, which defines an
array of bootstrappers 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. Typically, these
classes handle internal Laravel configuration
that you do not need to worry about.
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,
determining if the application is in
maintenance mode, verifying the CSRF token,
and more.
Do you know?
a) 200 OK
b) 404 Not Found
c) 500 Internal Server Error
d) 300 Multiple Choices
Which of the following is NOT a valid
HTTP response status code?
a) 200 OK
b) 404 Not Found
c) 500 Internal Server Error
d) 300 Multiple Choices
Which of the following is NOT a step in the
Laravel request lifecycle?
a) Middleware Execution
b) View Rendering
c) Route Registration
d) Database Migration