Register a plugin

- « Yaf_Dispatcher::initView

- Yaf_Dispatcher::returnResponse »

- PHP Manual
- Yaf_Dispatcher
- Register a plugin

# Yaf_Dispatcher::registerPlugin

(Yaf >=1.0.0)

Yaf_Dispatcher::registerPlugin — Register a plugin

### Description

public Yaf_Dispatcher::registerPlugin(Yaf_Plugin_Abstract `$plugin`): Yaf_Dispatcher

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

### Parameters

`plugin`

### Return Values

### Examples

Example #1 Yaf_Dispatcher::registerPlugin() example

    <?phpclass 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