maslosoft/gazebo
最新稳定版本:2.0.2
Composer 安装命令:
composer require maslosoft/gazebo
包简介
Plugin container
README 文档
README
Maslosoft Gazebo
Quick Install
composer require maslosoft/gazebo
Documentation
Plugin container
When developing plugins for Your application, these might come in very different kids. This library helps to manage plugins by providing sets of instantiated plugins required for various scenarios. All plugins for component using gazebo are configured as a one simple list - thus allowing for easy adding and removing them - without bothering which plugin type should go where.
Usage
//Plugins class WaterPlugin implements WetInterface { public $name = 'foo'; } class MetalPlugin implements HardInterface { public $options = false; } class GenericPlugin { } // Config: $config = [ TestModel::class => [ WaterPlugin::class, [ 'class' => MetalPlugin::class, 'options' => true ], GenericPlugin::class, ], ]; // Create plugins but only for selected interfaces $plugins = (new PluginFactory())->instance($this->config, $model, [ HardInterface::class, WetInterface::class ]); var_dump($plugins); // Created flyweight instances of two plugins //array(2) { // [0] => class Maslosoft\GazeboTest\Model\WaterPlugin#181 (1) { // public $name => string(3) "foo" // } // [1] => class Maslosoft\GazeboTest\Model\MetalPlugin#182 (2) { // public $options => bool(true) // public $class => string(38) "Maslosoft\GazeboTest\Model\MetalPlugin" // } //}
统计信息
- 总下载量: 5.77k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 3
- 推荐数: 0
其他信息
- 授权协议: AGPL
- 更新时间: 2015-03-13