PHPackages                             fengdangxing/hyperf-current-limit - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Caching](/categories/caching)
4. /
5. fengdangxing/hyperf-current-limit

ActiveLibrary[Caching](/categories/caching)

fengdangxing/hyperf-current-limit
=================================

hyperf-限流-接口并发控制

v1.0.9(2y ago)024MITPHPPHP &gt;=5.6.0

Since Jun 5Pushed 2y ago1 watchersCompare

[ Source](https://github.com/fengdangxing/hyperf-current-limit)[ Packagist](https://packagist.org/packages/fengdangxing/hyperf-current-limit)[ RSS](/packages/fengdangxing-hyperf-current-limit/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (11)Used By (0)

\####简版使用-主要增加自定义方法 放在验证类处理 [validation](https://github.com/hyperf/validation)

---

```
#配置路径 config/annotations.php 没有改文件新建
return [
    'scan' => [
        'paths' => [
            BASE_PATH . '/app',
            BASE_PATH . '/vendor/fengdangxing',//增加该配置
        ],
        'ignore_annotations' => [
            'mixin',
            'Notes',
            'Author',
            'Data',
            'Date'
        ],
    ],
];
```

\#配置config/app.php

```
return [
    'fengdangxing' => [
        'currentLimit' => [
            'rateLimitMin' => 50,//限流时间间隔内下限次数
            'rateLimitMax' => 100,//限流时间间隔内上限次数
            'rateLimitPeriod' => 5,//限流时间间隔s
            'rateLimitPausePeriod' => 5,//限流暂停时间s
            'rateLimitForbidPeriod' => 2 * 3600,//封禁时间s
        ]
    ]
];
```

\#控制器 userName 获取header参数名称-用于限制用户 -- 目前只能限制都用户级别或者有每个请求唯一的参数

```
