Introduction
IOC
- Controlling inversion inversion of control
- Transfer of dependencies
- Rely on abstraction rather than practice
DI
- Dependency Injection Dependency Injection
- You don't have to maintain object dependencies in your code.
- The container automatically injects dependencies into the specified object according to the configuration
The significance of IOC and di for laravel
The foundation of the Laravel framework is a powerful control inversion container (IoC container). In order to really understand the framework, you need to master the container well. However, we need to understand that the control reversal container is just a tool for facilitating "dependency injection". But to implement dependency injection does not necessarily require controlling the reversal container, it is easier and easier to use the container.
Detailed Introduction
For the understanding of Ioc/di, I repeat here once also the role is not small, here recommended three articles, believe that after reading, there will be a great harvest.
- What is the Laravel IOC container?
- How PHP Programmers understand Ioc/di
- From apprentice to artisan IOC
The first article mainly stands in the angle of Laravel, elaborated IOC, the second time article is standing in PHP angle. The last time the article was written by the Laravel author himself. Very valuable.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
6. Laravel5 study notes: Ioc/di's understanding