Skip to content

Commit 6c5a32f

Browse files
committed
fix: update readme
1 parent 9d2b941 commit 6c5a32f

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

README.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ Update your _config/services.yml_ like this:
7575
You can also create your own rate limit modifier by implementing `RateLimitModifierInterface` and tagging your service accordingly.
7676

7777
### Configure your routes
78+
79+
#### With annotations
80+
7881
Add the `@RateLimit()` annotation to your controller methods (by default, the limit will be 1000 requests per minute).
7982
This annotation accepts parameters to customize the rate limit. The following example shows how to limit requests on a route at the rate of 10 requests max every 2 minutes.
8083
:warning: This customization only works if the `limit_by_route` parameter is `true`
@@ -101,3 +104,21 @@ This annotation requires a list of endpoints and accepts parameters to customize
101104
* )
102105
*/
103106
```
107+
108+
#### In YAML
109+
110+
You also may add your rate limits in configuration files (Yaml) with the route name. If `period` or `limit` is not
111+
defined for a route, the bundle will take the common option.
112+
113+
```yaml
114+
bedrock_rate_limit:
115+
limit: 1000
116+
period: 60
117+
118+
routes:
119+
get_foobar:
120+
limit: 500
121+
period: 10
122+
post_foobar:
123+
period: 10
124+
```

0 commit comments

Comments
 (0)