Add prefix to all routes

You can actually use $app->group($path, $callable) to achieve this. Inside the callable, you can treat $this like $app outside the callable. So you could revise your example to:

$app->group('/users', function() {
    $this->get('/{id}', 'UserController:getUser');
    $this->get('', 'UserController:getUsers');
});