What are Deferred Service Providers?
Answer
Deferred service providers are not loaded on every request — they are loaded only when one of their bindings is actually needed. Implement the DeferrableProvider interface and define a provides() method that lists the container bindings the provider registers. Laravel's bootstrap/cache/services.php file caches this mapping. When something in the container resolves a listed binding, only then is the provider loaded. This improves bootstrap performance for large applications with many service providers. Example: a PDF generation service provider is deferred — it only loads when you actually use the PDF generator, not on every request. Most first-party Laravel packages use deferred providers. Always run php artisan optimize in production to regenerate the cached services manifest.