class MyController extends Controller { public function actionIndex() { // some code... } public function afterFilter() { // perform some post-processing actions here } }
class CachingController extends Controller { public function actionPage($id) { // some code... } public function afterFilter() { $response = $this->getResponse(); $cache = new Cache(); $cache->set($this->id, $response->getBody()); } }In this example, the afterFilter method caches the response from actionPage() and stores it in a cache. From the code examples, we can determine that the PHP Controller's afterFilter method is commonly used along with the caching or logging package library.