phmlabs/init

phmLabs component for initializing class using a yaml file / array

Installs: 13 240

Dependents: 3

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/phmlabs/init

2.0.0 2019-05-05 16:04 UTC

This package is auto-updated.

Last update: 2025-09-29 01:40:05 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);