phmlabs / init
phmLabs component for initializing class using a yaml file / array
Installs: 12 266
Dependents: 3
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 0
Open Issues: 0
Requires
- phmlabs/namedparameters: ~1.0.0
README
This library is a very lightweight dependency injection container. The special thing about Init
is that it uses names parameters and fits perfectly with yaml files this way.
class MyClass { public function __construct($firstParam, $secondParam = null) { // ... } } $options = [ 'class' => 'MyClass', 'call' => [ '__construct' => ['secondParam' => 'foo', 'firstParam' => 'bar'] ] ] $myClass = Init::initialize($options);