zendframework/zend-di

This package is abandoned and no longer maintained. The author suggests using the laminas/laminas-di package instead.

Automated dependency injection for PSR-11 containers


README

Repository abandoned 2019-12-31

This repository has moved to laminas/laminas-di.

Build Status Coverage Status

zend-di provides autowiring to implement Inversion of Control (IoC) containers. IoC containers are widely used to create object instances that have all dependencies resolved and injected. Dependency Injection containers are one form of IoC – but not the only form.

zend-di is designed to be simple, fast and reusable. It provides the following features:

  • Constructor injection
  • Autowiring:
    • Recursively through all dependencies
    • With configured type preferences
    • with configured injections
    • With injections passed in the create() call
  • Code generators to create factories usable by other IoC containers like Zend\ServiceManager

It does not provide:

  • Setter, interface, property or any other injection method than constructor injection
  • Support for factories
  • Declaring shared/unshared instances
    • the injector always creates new instances
    • the default container always shares instances
  • Support for variadic arguments in __construct

If you need these features combine it with another IoC container such as zend-servicemanager.