Support the ongoing development of Laravel.io →
Installation Configuration Packages
Last updated 2 years ago.
0

It doesn't matter where you place your provider class. As long as it extents Illuminate\Support\ServiceProvider and is defined in the config/app.php Laravel will treat it as a provider. The reason we define a provider and register everything there is because we don't have to write a lot.

For example its easier to use $this->app->singleton to register a class rather than defining the singleton construct in the class itself. You can also register any events, configuration, migrations, etc on the service provider class saving a lot of unnecessary coding.

Last updated 9 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.