You can use Laravel for years without stopping to understand what happens between a request coming in and a response going out. It works fine without that understanding — until the day something breaks in a way that only makes sense once you know what’s underneath.
This is a short guide to the main pieces and where to look when you need to configure or debug an application.
1. Understand Service Providers
The most important one is AppServiceProvider — in Laravel 11, in practice, it’s basically the only one left by default. Service providers bootstrap the framework’s components: database, queue, validation, routing. Day to day, we usually only touch the boot method to register something new — the rest is already handled by the framework.
2. Understand the Service Container
It’s Laravel’s central tool for dependency management and injection. It resolves a class instance and builds the object automatically, without you having to instantiate anything by hand.
This isn’t exclusive to controllers. Most classes you write — controllers, event listeners, middleware, jobs — receive dependencies via the container with no extra effort. You can even type-hint a dependency directly in a queue job’s handle method, and the container resolves it when the job runs.
3. Follow the request lifecycle
Every HTTP request goes through a pipeline: it enters through public/index.php, gets captured by the kernel, passes through the already-registered service providers, goes through the middleware stack, reaches the router, and only then hits the controller. The response takes the reverse path, passing through the same middlewares before going out. Understanding this flow helps pinpoint exactly where to intercept something — authentication, logging, response transformation — without forcing that logic into the controller.
4. Check two deployment details
php artisan route:cache— caches routes in production, so Laravel doesn’t have to resolve the routes file from scratch on every request.- A queue worker needs a real process supervisor (not just running
queue:workin a terminal and hoping for the best) — Laravel’s own documentation covers the Supervisor setup.
5. Use this checklist for a new project
A personal reference, based on Nuno Maduro’s laravel-starter-kit:
- Larastan configured from the start — catch type errors before they turn into production bugs.
- Strict mode enabled.
- Prevent a destructive command (like a migration) from running by accident in production.
What sticks
The Service Container and Service Providers are the heart of how Laravel resolves dependencies on its own. There’s no magic in it — there’s a well-defined mechanism, one that becomes much easier to debug and extend once you know where it fits in the request lifecycle.