Support the ongoing development of →
IOC Packages
Last updated 2 years ago.

You're right, you don't need to put anything in the provides() method since you aren't binding anything with register().

I believe provides() is only used for deferred service providers, i.e. service providers that don't get run when the framework boots, but when a service they provide is requested from the IoC container. When Laravel compiles, it checks what services each deferred service provider provides, caches that in the storage/meta/services.json file which can then be looked up to find out which service provider class to execute to get the requested binding registered.

Last updated 2 years ago.

I've been reading around and I thought it would be something like this.

There are various tutorials on creating a Laravel's package, but none of them talks about the purpose of the provides() method. It's clearer to me now.

Thanks maknz!

Last updated 2 years ago.

Its clearly describe the purpose of provides method in ServiceProvider class.

please have a look to


Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.