2017 © Pedro Peláez
 

library nerd-container

Lightweight IoC container with dependency injection

image

nerd-framework/nerd-container

Lightweight IoC container with dependency injection

  • Friday, November 25, 2016
  • by pldin601
  • Repository
  • 1 Watchers
  • 0 Stars
  • 70 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 7 Versions
  • 0 % Grown

The README.md

nerd-container

Build Status Coverage Status StyleCI, (*1)

Container with Dependency Injection for Nerd Framework., (*2)

Get the container:, (*3)

$container = new \Nerd\Framework\Container\Container();

Bind class constructor:, (*4)

$container->bind('foo', Foo::class);

Bind callable factory:, (*5)

$container->bind('factory', function () {
  return new Factory();
});

Bind singleton:, (*6)

$container->singleton('single', SingletonService::class);

Retrieve resources from container:, (*7)

$foo = $container->get('foo');

Invoke function, class method or class constructor with dependency injection:, (*8)

$result = $container->invoke(function (FooFactoryInterface $factory) {
  // $foo will be injected using parameter name
  // $other will be injected using Bar type hint
  return $factory->makeFoo();
});

Pass additional resources into invoke() method:, (*9)

$result = $container->invoke(function ($foo, $a, $b) {
  //
}, ["a" => "Hello", "b" => "World"]);

Resource resolver

Not documented yet., (*10)

The Versions

25/11 2016

dev-master

9999999-dev

Lightweight IoC container with dependency injection

  Sources   Download

The Requires

 

The Development Requires

by Roman Lakhtadyr

25/11 2016

v1.0.4

1.0.4.0

Lightweight IoC container with dependency injection

  Sources   Download

The Requires

 

The Development Requires

by Roman Lakhtadyr

25/11 2016

1.0.x-dev

1.0.9999999.9999999-dev

Lightweight IoC container with dependency injection

  Sources   Download

The Requires

 

The Development Requires

by Roman Lakhtadyr

05/10 2016

v1.0.3

1.0.3.0

Lightweight IoC container with dependency injection

  Sources   Download

The Requires

  • php >=5.6

 

The Development Requires

by Roman Lakhtadyr

05/10 2016

v1.0.2

1.0.2.0

Lightweight IoC container with dependency injection

  Sources   Download

The Requires

  • php >=5.6

 

The Development Requires

by Roman Lakhtadyr

13/05 2016

v1.0.1

1.0.1.0

Light IoC container with dependency injection.

  Sources   Download

by Roman Gemini

17/03 2016

v1.0

1.0.0.0

Light IoC container with dependency injection.

  Sources   Download

by Roman Gemini