2017 © Pedro Peláez
 

library plugin-manager

a simple observer pattern implementation

image

rpk/plugin-manager

a simple observer pattern implementation

  • Sunday, August 28, 2016
  • by Repkit
  • Repository
  • 1 Watchers
  • 0 Stars
  • 25 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

PluginManager

  • a simple observer pattern implementation inspired from zend-eventmanager. For complex workflows use zend-eventmanager
  • can be easily used with zend-expressive (http://zendframework.github.io/zend-expressive) in combinations with pipes (ex: changing/add data before returning HtmlResponse)

PluginResponseCollection is a copy of zend-eventmanager/ResponseCollection (http://github.com/zendframework/zend-eventmanager), (*1)

Usage

  • composer require rpk/plugin-manager
  • trigger event in app

    • ``` $plugin = \RpkPluginManager\PluginChain::getInstance();, (*2)

      $params = $plugin->prepareArgs(['template'=> 'page::edit', 'data' => $data]);, (*3)

      $plugin->trigger('page::edit-render.pre', $params);, (*4)

  • attach to an event

return [
   'plugin-manager' => [
        'page::edit-render.pre' => [
            new \RpkPluginManager\Plugin(\Coco\ChangeHome::class),
            new \RpkPluginManager\Plugin(function($params, $target){
                $params['data']['some_new_prop'] = 'some_new_value';
            }, 10, false, \RpkPluginManager\Plugin::TYPE_CALLABLE),
        ]    
    ]
];

The Versions

28/08 2016

dev-master

9999999-dev

a simple observer pattern implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

php events observer

28/08 2016

1.1.0

1.1.0.0

a simple observer pattern implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

php events observer

25/08 2016

1.0.0

1.0.0.0

a simple observer pattern implementation

  Sources   Download

MIT

The Requires

 

The Development Requires

php events observer