In the mwAuth function I would like to process the parameter to return 403 or proceed to the route. Otherwise I have to make a new middleware function for every route, or [switch-case] every route path (not an option).
class MwAuth
{
private $action;
public function __construct($action)
{
$this->action = $action;
}
public function __invoke($request, $response, $next)
{
// process using $action parameter
}
}