PHPackages                             andreyv/yii2-ip-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. [Security](/categories/security)
4. /
5. andreyv/yii2-ip-ratelimiter

ActiveYii2-module[Security](/categories/security)

andreyv/yii2-ip-ratelimiter
===========================

Allow guest clients to be rate limited, using their IP as the identifier.

2.3.1(3y ago)263.4k↓25.1%11MITPHP

Since Apr 29Pushed 3y agoCompare

[ Source](https://github.com/andrey-tm/yii2-ip-ratelimiter)[ Packagist](https://packagist.org/packages/andreyv/yii2-ip-ratelimiter)[ RSS](/packages/andreyv-yii2-ip-ratelimiter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (8)Used By (1)

[![Yii2 IP Rate Limiter](resources/banner.jpg)](resources/banner.jpg)

yii2-ip-ratelimiter
===================

[](#yii2-ip-ratelimiter)

Allow guest clients to be rate limited, using their IP as the identifier.

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require andreyv/yii2-ip-ratelimiter "2.*"

```

or add

```
"andreyv/yii2-ip-ratelimiter": "2.*"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Modify the bahavior method of the controller you want to rate limit

```
public function behaviors()
{
    $behaviors = parent::behaviors();
    $behaviors['rateLimiter'] = [
        // Use class
        'class' => \andreyv\ratelimiter\IpRateLimiter::class,

        // The maximum number of allowed requests
        'rateLimit' => 100,

        // The time period for the rates to apply to
        'timePeriod' => 600,

        // Separate rate limiting for guests and authenticated users
        // Defaults to false
        // - false: use one set of rates, whether you are authenticated or not
        // - true: use separate ratesfor guests and authenticated users
        'separateRates' => true,

        // Whether to return HTTP headers containing the current rate limiting information
        'enableRateLimitHeaders' => false,

        // Array of actions on which to apply ratelimiter, if empty - applies to all actions
        'actions' => ['index'],

        // Allows to skip rate limiting for test environment
        'testMode' => true,
        // Defines whether proxy enabled, list of headers getting from request ipHeaders. By default ['X-Forwarded-For']
        'proxyEnabled' => false
    ];
    return $behaviors;
}

```

Forked from ethercreative/yii2-ip-ratelimiter.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity68

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~490 days

Recently: every ~472 days

Total

6

Last Release

1216d ago

Major Versions

1.0 → 2.0.02017-11-15

### Community

Maintainers

![](https://www.gravatar.com/avatar/1d65eec839f435cbf5d71b98227dbefef0d4c71081d1304b291b0aeea068c54f?d=identicon)[andrey-tm](/maintainers/andrey-tm)

---

Top Contributors

[![andrey-tm](https://avatars.githubusercontent.com/u/23074051?v=4)](https://github.com/andrey-tm "andrey-tm (6 commits)")[![utrain-tm](https://avatars.githubusercontent.com/u/8993736?v=4)](https://github.com/utrain-tm "utrain-tm (6 commits)")[![CSharpRU](https://avatars.githubusercontent.com/u/640600?v=4)](https://github.com/CSharpRU "CSharpRU (4 commits)")[![alexjcollins](https://avatars.githubusercontent.com/u/12031196?v=4)](https://github.com/alexjcollins "alexjcollins (2 commits)")[![ch-tm](https://avatars.githubusercontent.com/u/22640796?v=4)](https://github.com/ch-tm "ch-tm (2 commits)")[![Xrymz](https://avatars.githubusercontent.com/u/309405?v=4)](https://github.com/Xrymz "Xrymz (1 commits)")

---

Tags

yii2ratelimiter

### Embed Badge

![Health badge](/badges/andreyv-yii2-ip-ratelimiter/health.svg)

```
[![Health](https://phpackages.com/badges/andreyv-yii2-ip-ratelimiter/health.svg)](https://phpackages.com/packages/andreyv-yii2-ip-ratelimiter)
```

###  Alternatives

[nickcv/yii2-encrypter

Openssl Encrypter for Yii2

19640.0k1](/packages/nickcv-yii2-encrypter)

PHPackages © 2026

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