Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

The suggestion to Yii2 core team is to design RateLimiter filter good enough not only for API calls, but to make it more reusable in simple controllers. #63

Closed
gauravpatel1110 opened this issue Feb 23, 2018 · 4 comments
Labels
type:feature New feature
Milestone

Comments

@gauravpatel1110
Copy link

Here is the use case:

Limit number of API calls globally - 5 requests/second
Limit number of API calls for action1 - 30 requests/minute
Limit number of API calls for action2 - 60 requests/minute

Limit number of successfull user registrations (action /register) - 1/hour
Limit number of failed user logins (action /login) - 5 requests/15 minutes
Add possibility to have 1 shared limit for several actions

Make This With FileCache.

@tyler-ham
Copy link

I just published an advanced rate limiter that I've been working on and using for a while:
https://github.com/thamtech/yii2-ratelimiter-advanced

I believe it would meet the requirements of the use case you describe.

@samdark samdark transferred this issue from yiisoft/yii2 Apr 23, 2019
@samdark
Copy link
Member

samdark commented Aug 7, 2019

Rate limiter should be implemented as middleware.

@samdark samdark added status:ready for adoption Feel free to implement this issue. type:feature New feature labels Aug 7, 2019
@samdark samdark pinned this issue Aug 17, 2019
@kamarton
Copy link
Contributor

kamarton commented Nov 3, 2019

I would recommend separate the actual counting unit and using it anywhere in the code, eg sending SMS limit.

@samdark samdark added status:under development Someone is working on a pull request. and removed status:ready for adoption Feel free to implement this issue. labels Jan 5, 2020
@samdark samdark added this to the 3.0.0-alpha1 milestone Jan 17, 2020
@samdark samdark removed the status:under development Someone is working on a pull request. label Jan 17, 2020
@samdark samdark closed this as completed Feb 13, 2020
@samdark
Copy link
Member

samdark commented Feb 13, 2020

This one is now done.

@samdark samdark unpinned this issue Feb 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:feature New feature
Projects
None yet
Development

No branches or pull requests

4 participants