PHPackages                             easyswoole/atomic-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. [Framework](/categories/framework)
4. /
5. easyswoole/atomic-limit

ActiveLibrary[Framework](/categories/framework)

easyswoole/atomic-limit
=======================

An efficient swoole framework

2.0.0(5y ago)59.2k↑668.8%1[1 issues](https://github.com/easy-swoole/atomic-limit/issues)1Apache-2.0PHPPHP &gt;=7.1.0

Since Jul 25Pushed 5y agoCompare

[ Source](https://github.com/easy-swoole/atomic-limit)[ Packagist](https://packagist.org/packages/easyswoole/atomic-limit)[ Docs](https://www.easyswoole.com/)[ RSS](/packages/easyswoole-atomic-limit/feed)WikiDiscussions 2.x Synced today

READMEChangelog (3)Dependencies (2)Versions (5)Used By (1)

AtomicLimit
===========

[](#atomiclimit)

Easyswoole提供了一个基于Atomic计数器的限流器。

原理
--

[](#原理)

通过限制某一个时间周期内某个token的总请求数，从而实现基础限流。

安装
--

[](#安装)

```
composer require easyswoole/atomic-limit

```

示例代码
----

[](#示例代码)

以经典的暴力CC攻击防护为例子。我们可以限制一个ip-url的qps访问。

```
use EasySwoole\AtomicLimit\AtomicLimit;
$limit = new AtomicLimit();

$http = new swoole_http_server("127.0.0.1", 9501);
/** 为方便测试，限制设置为3 */
$limit->setLimitQps(3);
$limit->attachServer($http);

$http->on("request", function ($request, $response)use($http,$limit) {
    $ip = $http->getClientInfo($request->fd)['remote_ip'];
    $requestUri = $request->server['request_uri'];
    $token = $ip.$requestUri;
    /** access函数允许单独对某个token指定qps */
    if($limit->access($token)){
        $response->write('request accept');
    }else{
        $response->write('request refuse');
    }
    $response->end();
});

$http->start();
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~169 days

Total

4

Last Release

2027d ago

Major Versions

1.0.2 → 2.0.02020-12-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/45c234d5f129ea570e630425636299127647534f0c2cbb073555e2c45d403d6f?d=identicon)[kiss291323003](/maintainers/kiss291323003)

---

Top Contributors

[![kiss291323003](https://avatars.githubusercontent.com/u/24490609?v=4)](https://github.com/kiss291323003 "kiss291323003 (5 commits)")

---

Tags

asyncframeworkswooleeasyswoole

### Embed Badge

![Health badge](/badges/easyswoole-atomic-limit/health.svg)

```
[![Health](https://phpackages.com/badges/easyswoole-atomic-limit/health.svg)](https://phpackages.com/packages/easyswoole-atomic-limit)
```

###  Alternatives

[easyswoole/easyswoole

An efficient swoole framework

4.8k190.3k55](/packages/easyswoole-easyswoole)[easyswoole/orm

php stander lib

3090.9k27](/packages/easyswoole-orm)[easyswoole/kafka

An efficient swoole framework

4211.5k](/packages/easyswoole-kafka)[easyswoole/fast-cache

An efficient swoole framework

1030.7k4](/packages/easyswoole-fast-cache)[easyswoole/actor

easyswoole component

1410.4k](/packages/easyswoole-actor)[easyswoole/words-match

An efficient swoole framework

171.6k8](/packages/easyswoole-words-match)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
