|
The Yaf_Plugin_Abstract classIntroductionPlugins allow for easy extensibility and customization of the framework. A plugin is a class extending Yaf_Plugin_Abstract that overrides one or more hook methods, which are called automatically at fixed points of the dispatch cycle: before and after routing, before and after the dispatch loop, and before and after each single dispatch. A plugin is attached to the dispatcher with Yaf_Dispatcher::registerPlugin, typically in the Bootstrap; after registration, all the hook methods the plugin implements are called at the proper time, each receiving the current Yaf_Request_Abstract and Yaf_Response_Abstract instances. ExamplesExample #1 Plugin example The above example will output something similar to: string(13) "routerStartup" string(14) "routerShutdown" string(19) "dispatchLoopStartup" string(11) "preDispatch" string(12) "postDispatch" string(20) "dispatchLoopShutdown" Class synopsisYaf_Plugin_Abstract
class Yaf_Plugin_Abstract
{
/* Methods */
public void dispatchLoopShutdown(Yaf_Request_Abstract
$request, Yaf_Response_Abstract $response)public void dispatchLoopStartup(Yaf_Request_Abstract
$request, Yaf_Response_Abstract $response)public void postDispatch(Yaf_Request_Abstract
$request, Yaf_Response_Abstract $response)public void preDispatch(Yaf_Request_Abstract
$request, Yaf_Response_Abstract $response)public void preResponse(Yaf_Request_Abstract
$request, Yaf_Response_Abstract $response)public void routerShutdown(Yaf_Request_Abstract
$request, Yaf_Response_Abstract $response)public void routerStartup(Yaf_Request_Abstract
}$request, Yaf_Response_Abstract $response)
|