Yaf_Plugin_Abstract::dispatchLoopStartup
Hook before dispatch loop
Description
public void Yaf_Plugin_Abstract::dispatchLoopStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
This hook is triggered once, right before the dispatch loop starts and the view engine is initialized.
Parameters
-
request
-
The Yaf_Request_Abstract instance being dispatched.
-
response
-
The Yaf_Response_Abstract instance.
Return Values
No value is returned.
Examples
Example #1 Yaf_Plugin_Abstract::dispatchLoopStartup example
<?php
class BenchmarkPlugin extends Yaf_Plugin_Abstract
{
public function dispatchLoopStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response)
{
/* the view engine is not initialized yet, so this hook is a
* good place to start request-wide bookkeeping */
Yaf_Registry::set("request_start", microtime(true));
}
}
/* plugins are registered in the bootstrap */
class Bootstrap extends Yaf_Bootstrap_Abstract
{
public function _initPlugin(Yaf_Dispatcher $dispatcher)
{
$dispatcher->registerPlugin(new BenchmarkPlugin());
}
}
?>
See Also
- Yaf_Plugin_Abstract::routerStartup
- Yaf_Plugin_Abstract::routerShutdown
- Yaf_Plugin_Abstract::preDispatch
- Yaf_Plugin_Abstract::postDispatch
- Yaf_Plugin_Abstract::dispatchLoopShutdown
- Yaf_Plugin_Abstract::preResponse