Posted On: Feb 22, 2018
Hooks are function in Slim framework that is used/ register as callbacks. Slim Provides a wide range of Hooks. slim.before, slim.before.router, slim.before.dispatch, slim.after are few default hooks that used in Slim.
Note: Hooks are used in Slim version 2.x and completely removed in Slim 3.x.
Using Hook in Slim Framework:
<?php $app = new \Slim\Slim(); $app->hook('the.hook.name', function () { //Do something });
Never Miss an Articles from us.
How is Slim framework different from other frameworks like Laravel, Symfony or Zend?..
Is Slim framework similar to Symfony’s Silex? How do they differ?..