Dependency Injection in Zend Framework
The Zend Framework is a step closer to having its own DI Container.
Bradley Holt has announced the creation of a new proposal Zend_Container, a simplified version of Zend_Di. According to him, if the framework is going to have a dependency injection component this component needs to be as simple as possible, something along the lines of PicoContainer.
- The component’s primary purpose is to replace the use of class-managed singletons and Zend_Registry.
- The component will only manage singleton items within a container, it will not act as a factory (except for creating the single instance).
- A container can have zero or one parent container and have access to items in its parent, but a parent cannot have access to items in its children.
- The component uses reflection to determine dependencies.
The Xyster team has already implemented a similar component, Xyster_Container, a Dependency Injection container based very heavily on PicoContainer, however the main goal of Zend_Container is simplicity.
The good news is that, for the first time, Zend has given the official go-ahead for the development of this component.
More info: Dependency Injection in Zend Framework