php - Slim Set Middleware -


what's right way set custom middleware specific route calling setmiddleware method? wrote custom middleware:

custommiddleware

namespace slim\middleware;  class custommiddleware extends \slim\middleware {     public function __construct() {         // omitted     }      public function call() {         // omitted     } } 

then want set specific route:

$app->get(         '/api/users(/)', function () use ($app) {     echo 'middleware passed.'; })->setmiddleware(new \slim\middleware\custommiddleware()); 

using way get:

invalidargumentexception: route middleware must callable or array of callables in c:\dev\rest\slim\route.php on line 336 

any help? many thanks.


Comments

Popular posts from this blog

python 3.x - Mapping specific letters onto a list of words -

javascript - jquery or ashx not working -

inno setup - TLabel or TNewStaticText - change .Font.Style on Focus like Cursor changes with .Cursor -