|Classes of Saiik on||Dependency Injection Container||README.md||Download|
Container gives you a small dependency injetion to use in your projects
Run 'composer require saiik\container' and include your autoload.php
The container class needs at least 1 parameter. The first parameter defines the "namespace" for your container. The 2nd one is a configuration array.
Register a new instance
To register a new instance you can do it in 2 ways.
__When your class has dependencies on other classes, it will resolve them automatically.__
_In case you have dependencies on interfaces or an abstract class, you can set "mockup" in your configuration to true and it will mock up your interface / abstract class._
Using the register method
You can use the register method. This method expects at least 2 parameters.
Using the container object as an array
Also you can handle the container object as an array and register objects without any functions.
Get a stored instance
To get one instance stored in the container just run this simple function:
And you get your instance.