The routerShutdown purpose

- « Yaf_Plugin_Abstract::preResponse

- Yaf_Plugin_Abstract::routerStartup »

- PHP Manual
- Yaf_Plugin_Abstract
- The routerShutdown purpose

# Yaf_Plugin_Abstract::routerShutdown

(Yaf >=1.0.0)

Yaf_Plugin_Abstract::routerShutdown — The routerShutdown purpose

### Description

public Yaf_Plugin_Abstract::routerShutdown(Yaf_Request_Abstract `$request`, Yaf_Response_Abstract `$response`): void

This hook will be trigged after the route process finished, this hook is usually used for login check.

### Parameters

`request`

`response`

### Return Values

### Examples

Example #1 Yaf_Plugin_Abstract::routerShutdown()example

    <?phpclass UserInitPlugin extends Yaf_Plugin_Abstract {    public function routerShutdown(Yaf_Request_Abstract $request, Yaf_Response_Abstract $response) {        $controller = $request->getControllerName();        /**         * Use access controller is unecessary for APIs         */        if (in_array(strtolower($controller), array(            'api',          ))) {            return TRUE;        }               if (Yaf_Session::getInstance()->has("login")) {            return TRUE;        }         /* Use access check failed, need to login */        $response->setRedirect("http://yourdomain.com/login/");        return FALSE;    }}?>

### See Also

- Yaf_Plugin_Abstract::routerStartup() - RouterStartup hook
- Yaf_Plugin_Abstract::dispatchLoopStartup() - Hook before dispatch loop
- Yaf_Plugin_Abstract::preDispatch() - The preDispatch purpose
- Yaf_Plugin_Abstract::postDispatch() - The postDispatch purpose
- Yaf_Plugin_Abstract::dispatchLoopShutdown() - The dispatchLoopShutdown purpose