I am using silex to create an api and my routes look something similar to this:
$api = $app['controllers_factory'];
$users = $app['controllers_factory'];
$users->match('/', UsersController::action);
$api->mount('/users', $users);
$app->mount('/api', $api);
So the route would be baseurl/api/users
What I want to do now is to attach a before() to the $api controller group and enforce validation for the api, so any link prefixed with /api/...users, posts would require validation. But it seems that is not the way it works, when i put a before to the $api, it only works for the root of /api, not api/users or api/posts or api/categories, they require their own middlewares.
So my question is : how can I enforce everything after baseurl/api/... to require validation in a Silex enviroment.