Yaf_Plugin_Abstract::dispatchLoopStartup
PHP function
Edit on GitHub ✎
(Yaf >=1.0.0)
Hook before dispatch loop
Description
Yaf_Plugin_Abstract::dispatchLoopStartup(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response): void
This hook is triggered once, right before the dispatch loop starts and the view engine is initialized.
Parameters
requestThe
Yaf_Request_Abstractinstance being dispatched.responseThe
Yaf_Response_Abstractinstance.
Return Values
No value is returned.
Examples
Yaf_Plugin_Abstract::dispatchLoopStartup example
php
<?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::routerStartupYaf_Plugin_Abstract::routerShutdownYaf_Plugin_Abstract::preDispatchYaf_Plugin_Abstract::postDispatchYaf_Plugin_Abstract::dispatchLoopShutdownYaf_Plugin_Abstract::preResponse