Yii Factory 1.3
Version 1.3 of Yii Factory package is released.
In this version added StrictFactory that differs in that it processes only configured definitions.
Version 1.3 of Yii Factory package is released.
In this version added StrictFactory that differs in that it processes only configured definitions.
Version 1.2 of Yii Factory package is released. There are one improvement, the container is made optional.
First version of Factory package was released. This package provides abstract object factory allowing to create objects by given definition with dependencies resolved by a PSR-11 container. It is useful if you need to create objects using definition syntax and/or want to configure defaults for objects created.
$container = new PSR11DependencyInjectionContainer();
$factoryConfig = [
EngineInterface::class => [
'class' => EngineMarkOne::class,
'__construct()' => [
'power' => 42,
],
]
];
$factory = new Factory($container, $factoryConfig);
$one = $factory->create(EngineInterface::class);
$two = $factory->create([
'class' => EngineInterface::class,
'__construct()' => [
'power' => 146,
],
]);
See package README for more details.