S
S
semki0962019-03-15 15:40:48
Slim Framework
semki096, 2019-03-15 15:40:48

What is the best dependency injection option?

In Slim I use containers for dependency injection. As far as I understand there are 2 options. 1. We create the main controller, the rest inherit it. We pass the entire container to the main controller, and we already display what we need from the children. The method is convenient, but it seems wasteful to me.
2. We do not pass the entire container to each class, but only what we need. I think this way is more rational, but you can get confused.
The question is, if I choose the first option, how much will it affect resource consumption, performance, etc.? Is it rational to do this on small projects?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question