phmlabs/init

phmLabs component for initializing class using a yaml file / array

2.0.0 2019-05-05 16:04 UTC

This package is auto-updated.

Last update: 2024-10-29 04:09:25 UTC


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);