Can you use a single IP in the options
Closed this issue · 4 comments
DavidePastore commented
Can I restrict route only to a given IP address?
$options = array(
'ip' => '192.168.0.1'
);
$app->get('/api/myEndPoint',function ($req, $res, $args) {
//Your amazing route code
})->add(new \DavidePastore\Slim\RestrictRoute\RestrictRoute($options));
See also: Respect/Validation#775
sgotre commented
Yes you can ;)
$options = array(
'ip' => '192.168.0.1-192.168.0.1'
);
This seems a bit hacky, but it works
DavidePastore commented
@sgotre Thanks for your suggestion! I added a line in the documentation for this. 👍
adarshmadrecha commented
@DavidePastore The documentation at http://respect.github.io/Validation/docs/ip.html does not contain this feature / example
DavidePastore commented
@adarshmadrecha You're correct. The documentation at Respect/Validation doesn't contain this example, but you can find it in the Slim-Restrict-Route one.