2017 © Pedro Peláez
 

library di

A lightweight dependency injector

image

pkerrigan/di

A lightweight dependency injector

  • Saturday, February 24, 2018
  • by patrickkerrigan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 5 Versions
  • 9 % Grown

The README.md

Build Status Code Climate Coverage PHP 8.4 Packagist, (*1)

pkerrigan/di

A simple, lightweight PHP 8.4 dependency injector., (*2)

Why?

This was for fun, and doesn't really compare to the features offered by the popular dependency injectors. If you just need to inject objects then you may find this useful., (*3)

Usage

$injector = Injector::getInstance();

$injector->addClassResolver(new ArrayMapClassResolver([
    Interface::class => ConcreteImplementation::class
]));

$instance = $injector->get(Interface::class);

By default, all objects are treated as lazy singletons (that is, the same object will be returned for successive calls to get()). If you wish an object to be constructed again for every call of get (or injection) then you can explicitly define it as a Prototype like so:, (*4)

$injector->addClassResolver(new ArrayMapClassResolver([
    Interface::class => new Prototype(ConcreteImplementation::class)
]));

The Versions

24/02 2018

dev-master

9999999-dev

A lightweight dependency injector

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

dependency injection container di injector psr11

24/02 2018

v1.1.1

1.1.1.0

A lightweight dependency injector

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

dependency injection container di injector psr11

24/02 2018

v1.1.0

1.1.0.0

A lightweight dependency injector

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

dependency injection container di injector psr11

18/11 2017

v1.0.1

1.0.1.0

A lightweight dependency injector

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires

dependency injection container di injector psr11

18/11 2017

v1.0.0

1.0.0.0

A lightweight dependency injector

  Sources   Download

BSD-3-Clause

The Requires

 

The Development Requires