Factory 1.0.0
2021-12-11
827次浏览
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.
新闻归档
热门标签
- yii3
- 扩展
- 发布
- yii2
- debug
- auth client
- view
- bootstrap
- release
- html
- redis
- apidoc
- Yii 2.0
- Yii 1.1
- mongodb
- mailer
- extensions
- twig
- gii
- queue
- runner
- http 客户端
- console
- validation
- cache
- sphinx
- widget
- hydrator
- translator
- symfonymailer
- db
- http
- log
- error handler
- config
- swiftmailer
- 图书
- imagine
- assets
- i18n
- IDE
- swagger
- elasticsearch
- router
- csrf
- smarty
- definitions
- logging
- fastroute
- user