-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[RateLimiter] [WIP] add attribute for controllers methods #59920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 7.4
Are you sure you want to change the base?
Changes from 1 commit
00a59a3
6b0c5a9
67316e3
279217d
dd2dc8e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||
---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,32 @@ | ||||||||
<?php | ||||||||
|
||||||||
/* | ||||||||
* This file is part of the Symfony package. | ||||||||
* | ||||||||
* (c) Fabien Potencier <fabien@symfony.com> | ||||||||
* | ||||||||
* For the full copyright and license information, please view the LICENSE | ||||||||
* file that was distributed with this source code. | ||||||||
*/ | ||||||||
|
||||||||
namespace Symfony\Component\RateLimiter\Attribute; | ||||||||
|
||||||||
/** | ||||||||
* Add the hability to rate limit a method from a controller | ||||||||
* | ||||||||
* @see https://symfony.com/doc/current/rate_limiter.html | ||||||||
* | ||||||||
* @author Raziel Rodrigues <raziel.rodrigues@outlook.pt> | ||||||||
*/ | ||||||||
#[\Attribute(\Attribute::IS_REPEATABLE | \Attribute::TARGET_METHOD)] | ||||||||
final class RateLimit | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll need to rename this file to match the class name: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||||||||
{ | ||||||||
/** | ||||||||
* @param string $limiter The name of the limiter to use | ||||||||
* @param array $methods Methods to apply the rate limit | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||
*/ | ||||||||
public function __construct( | ||||||||
public string $limiter, | ||||||||
public array $methods | ||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
My thinking is: |
||||||||
) {} | ||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.