Answer the question
In order to leave comments, you need to log in
What is Service Container and Service Provider?
I read the documentation, but a few lines of code from the example make it unclear why this is needed and where to apply it.
For writing relatively simple sites and applications, it is probably not necessary. But it is interesting and I want to understand the architecture. And looking under the hood (via ctrl + mouse click in ide) to the internals of Laravel, the eyes run wide from the abundance of classes and dependencies.
Can you explain using the most primitive example why this is needed and why it is convenient?
Answer the question
In order to leave comments, you need to log in
To understand this, even a detailed answer is not enough. You should first read about the dependency inversion principle, one of the principles of SOLID. Then figure out what the dependency injection design pattern is and how they came to it at all (service locator is also mentioned). And then we actually come to the implementation of this pattern in laravel. You can also take note of the php di library - just a different implementation.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question