Support the ongoing development of Laravel.io →
IOC Architecture

Say I have ~20 models, so ~20 repositories, then I want to have interfaces as well so I have about 20 App::bind(); in my routes.php file so I decided to use service providers. Is it kosher to have service provider for every repository?

What is the benefit in a first place?

Why not just create file like "app/bindings.php" (along with observers.php, where are all the listeners stored) and fill them up with ~20 App::bind(); lines?

Last updated 3 years ago.
0

I did it the second way (one service provider file with multiple bindings) and I am happy with it so far. I'd like to hear opinions on this as well.

Last updated 3 years ago.
0

Sign in to participate in this thread!

PHPverse

Your banner here too?

Kyslik kyslik Joined 23 Jul 2014

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.

© 2025 Laravel.io - All rights reserved.