PHPackages                             frankerzeng/easy\_ratelimiter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. frankerzeng/easy\_ratelimiter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

frankerzeng/easy\_ratelimiter
=============================

基于内存的访问频率限制

v1.0(6y ago)25MITPHPPHP &gt;=5.5.0

Since Jul 2Pushed 6y ago1 watchersCompare

[ Source](https://github.com/frankerzeng/easy_ratelimiter)[ Packagist](https://packagist.org/packages/frankerzeng/easy_ratelimiter)[ RSS](/packages/frankerzeng-easy-ratelimiter/feed)WikiDiscussions master Synced today

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

php ratelimiter
===============

[](#php-ratelimiter)

基于内存的访问频率限制

作者在项目中用到的地方是登录注册风控，限制登录请求的次数，如10分钟内只能重试5次、短信验证码1分钟内最多发一次，24小时内最多发5次等

Setup/Installation
------------------

[](#setupinstallation)

You can include this library by running:
`composer require frankerzeng/easy_ratelimiter`

### Example

[](#example)

```
// 验证10秒内1次访问
$validate = (new Ratelimiter(['type' => "17665544332", 'times' => 1, 'time' => 10]))->check();
var_dump($validate);// bool(true)

$validate = (new Ratelimiter(['type' => "17665544332", 'times' => 1, 'time' => 10]))->check();
var_dump($validate);// bool(false)
```

### Debug

[](#debug)

进入服务器控制共享内存

ipcs -m 查看本机共享内存的状态和统计

ipcrm -m shmid 清除共享内存中的数据。

### Notice

[](#notice)

- 需要开启shmop拓展

    在Dockerfile中加入RUN docker-php-ext-install shmop
- 并发高的情况需要考虑原子性

### TODO

[](#todo)

由于共享内存的写操作不是原子性的，在并发大的情况下应该增加并发控制，保证原子性

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

2505d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b3e1a0af08a701ebd746ae5f00a6321b797952b0521fc38f7ec2a9a1b2fffc8b?d=identicon)[frankerzeng](/maintainers/frankerzeng)

---

Top Contributors

[![frankerzeng](https://avatars.githubusercontent.com/u/5513023?v=4)](https://github.com/frankerzeng "frankerzeng (3 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/frankerzeng-easy-ratelimiter/health.svg)

```
[![Health](https://phpackages.com/badges/frankerzeng-easy-ratelimiter/health.svg)](https://phpackages.com/packages/frankerzeng-easy-ratelimiter)
```

PHPackages © 2026

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