$inject= new Injector(new ConfiguredBindings('bindings.ini'));
$session= $inject->get('scriptlet.Session');
$apiKey= $inject->get('string', 'api-key');
Inside an XPCLI:
use util\PropertyAccess;
class Test extends \util\cmd\Command {
private $inject;
#[@inject(name= 'bindings')]
public function useInjector(PropertyAccess $prop) {
$this->inject= new Injector(new ConfiguredBindings($prop));
}
// ....
}
Examples
Binding to a class:
Binding to an instance, passing parameters:
Binding primitives:
Using namespaces:
Using ConfiguredBindings for the Injector.
Inside an XPCLI: