I've just started trying out Phalcon Micro for my RestAPI's.
Everything is working well, however I can't seem to figure out how to secure some routes, but not others.
Has anyone had any experience in this area? - I've come from Slim where I can just pass functions in the actual route definitions.
Cheers,
Ben
Here is one way to achieve this, you can use beforeMatch()
on your route, as you are used to with Slim.
$router->add('/koshnitsa', 'Basket::index')->setName('basket')->beforeMatch(
function ($uri, $route) {
// Replace with your conditions
if ($https) {
return true;
}
return false;
}
);
You can even make your own filter, read more in the docs.