What is a hook in Slim Framework?

devquora
devquora

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.beforeslim.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:

&lt?php
$app = new \Slim\Slim();
$app->hook('the.hook.name', function () {
    //Do something
});

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Slim Framework Interview Questions

    How is Slim framework different from other frameworks like Laravel, Symfony or Zend?

    How is Slim framework different from other frameworks like Laravel, Symfony or Zend?..

    Slim Framework Interview Questions

    Is Slim framework similar to Symfony’s Silex? How do they differ?

    Is Slim framework similar to Symfony’s Silex? How do they differ?..