Skip to content

Conversation

@lagaisse
Copy link
Contributor

I rewrote the _check_limit method so It can be configured to the needs of almost everyone.

It solves #397 while being compatible with less restrictive needs.

With

$config['rest_limits_method'] = 'API_KEY'; // put a limit per api key

limits are based on the api key only

$this->methods = ['myAPI_KEY' => ['level' => 0, 'limit' => 1, 'time' => 60 * 60 * 24]];

With

$config['rest_limits_method'] = 'METHOD_NAME'; // put a limit on method calls

limits are based on the called method

$this->methods = ['method_name_get' => ['level' => 0, 'limit' => 1, 'time' => 60 * 60 * 24]];

With

$config['rest_limits_method'] = 'ROUTED_URL';  // put a limit on the routed URL

limits are based on the URL (without the format extension but with the HTTP_METHOD) and the method which is the best option in my opinion

$this->methods = ['method_name_get' => ['level' => 0, 'limit' => 1, 'time' => 60 * 60 * 24]];

@softwarespot
Copy link
Contributor

This is very cool. Thanks.

@chriskacerguis
Copy link
Owner

Can you rebase?

@lagaisse
Copy link
Contributor Author

Thank you, I appreciate ;-)

@lagaisse lagaisse closed this Jul 21, 2015
chriskacerguis added a commit that referenced this pull request Jul 22, 2015
Fixed missing semi-colon and implemented #510
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants