DavidePastore/Slim-Restrict-Route

Can you use a single IP in the options

Closed this issue · 4 comments

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

Yes you can ;)

 $options = array(
  'ip' => '192.168.0.1-192.168.0.1'
);

This seems a bit hacky, but it works

@sgotre Thanks for your suggestion! I added a line in the documentation for this. 👍

@DavidePastore The documentation at http://respect.github.io/Validation/docs/ip.html does not contain this feature / example

@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.