Yaf_Dispatcher::registerPlugin

(Yaf >=1.0.0)
Register a plugin
public Yaf_Dispatcher Yaf_Dispatcher::registerPlugin ( Yaf_Plugin_Abstract $plugin )

Register a plugin(see Yaf_Plugin_Abstract). Generally, we register plugins in Bootstrap(see Yaf_Bootstrap_Abstract).

Parameters:
plugin

Register a plugin(see Yaf_Plugin_Abstract). Generally, we register plugins in Bootstrap(see Yaf_Bootstrap_Abstract).

Returns:
Examples:
Yaf_Dispatcher::registerPlugin() example
<?php
class Bootstrap extends Yaf_Bootstrap_Abstract {
  public function _initPlugin(Yaf_Dispatcher $dispatcher) {
    /**
    * Yaf assumes plugin scripts under [application.directory] .  "/plugins" 
    * for this case, it will be:
    * [application.directory] . "/plugins/" . "User" . [application.ext]
    */ 
    $user = new UserPlugin();
    $dispatcher->registerPlugin($user);
  }
}
?>

See also:

Yaf_Plugin_Abstract -

Yaf_Bootstrap_Abstract -

doc_php
2016-02-24 16:07:19
Comments
Leave a Comment

Please login to continue.