2017 © Pedro Peláez
 

library ioc

CoRex IoC

image

corex/ioc

CoRex IoC

  • Saturday, April 28, 2018
  • by corex
  • Repository
  • 0 Watchers
  • 0 Stars
  • 53 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 36 % Grown

The README.md

CoRex IoC

License Build Status codecov, (*1)

This is a simple container helping managing class dependencies and performing dependency injection., (*2)

Methods.

  • getInstance() - Get instance of container.
  • clear() - Clear container for all bindings and instances.
  • getBindings() - Get bindings.
  • getBinding() - Get specific binding.
  • has() - Check if class or interface has been bound.
  • hasInstance() - Check if class or interface has been instantiated.
  • isShared() - Check if class or interface is shared/is a singleton.
  • isSingleton() - Check if class or interface is shared/is a singleton.
  • forget() - Forget specified binding and instance.
  • bind() - Bind class or instance.
  • singleton() - Bind class or instance as shared/singleton.
  • instance() - Set instance on existing binding.
  • make() - Make instance of class or interface.

Create a container.

// Create new container.
$container = new Container();

// Create/use existing container.
$container = Container::getInstance();

Make a class without binding.

$myClass = Container::getInstance()->make(MyClass::class);

Make a class with binding and parameters.

$container = Container::getInstance();

$container->bind(MyClassInterface::class, MyClass::class);

$myClass = $container->make(MyClass::class, [
    'test' => 'my.value'
]);
  • When making a class via bound interface, the instance class will be checked if it implements the bound interface.
  • When making a class via bound base-class, the instance class will be checked if it extends the bound base class.

The Versions

28/04 2018

dev-master

9999999-dev

CoRex IoC

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

28/04 2018

dev-develop

dev-develop

CoRex IoC

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

28/04 2018

1.0.1

1.0.1.0

CoRex IoC

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires

26/01 2018

1.0.0

1.0.0.0

CoRex IoC

  Sources   Download

MIT

The Requires

  • php >=7.0

 

The Development Requires