PHPackages                             drsdre/yii2-redis-counter - 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. drsdre/yii2-redis-counter

ActiveYii2-extension[Caching](/categories/caching)

drsdre/yii2-redis-counter
=========================

Redis Counter implements fast atomic counters using Redis storage.

1.0(10y ago)216.6k↓35.7%1MITPHP

Since Jan 16Pushed 10y ago1 watchersCompare

[ Source](https://github.com/drsdre/yii2-redis-counter)[ Packagist](https://packagist.org/packages/drsdre/yii2-redis-counter)[ RSS](/packages/drsdre-yii2-redis-counter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (3)Versions (3)Used By (0)

Yii2 Redis Counter
==================

[](#yii2-redis-counter)

Redis Counter implements fast atomic counters using Redis storage.

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

[](#installation)

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

Either run

```
php composer.phar require --prefer-dist drsdre/yii2-redis-counter "*"

```

or add

```
"drsdre/yii2-redis-counter": "*"

```

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

Usage
-----

[](#usage)

You need to setup the client as application component:

```
'components' => [
    'redisCounter' => [
        'class' => 'drsdre\redis\Counter',
    ],
    ...
]
```

Optional the parameter 'redis' can be added to specify a specific Redis connection.

Usage
-----

[](#usage-1)

Once the extension is installed, use it in your code like :

```
    // Create a hourly counter
    $counter_key = 'hourly_statistics';

    // Check if counter is setup
    if (Yii::$app->redisCounter->exists($counter_key)) {
        // Atomic increment counter with 1
        Yii::$app->redisCounter->incr($counter_key);
    } else {
        // Create counter set value to 1 and let it exist for 1 hour
        Yii::$app->redisCounter->set($counter_key, 1, 60*60);
    }
```

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity29

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity64

Established project with proven stability

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

Total

2

Last Release

3775d ago

Major Versions

0.2 → 1.02016-01-16

### Community

Maintainers

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

---

Top Contributors

[![drsdre](https://avatars.githubusercontent.com/u/809827?v=4)](https://github.com/drsdre "drsdre (2 commits)")

---

Tags

redisyii2extensioncounteratomic

### Embed Badge

![Health badge](/badges/drsdre-yii2-redis-counter/health.svg)

```
[![Health](https://phpackages.com/badges/drsdre-yii2-redis-counter/health.svg)](https://phpackages.com/packages/drsdre-yii2-redis-counter)
```

###  Alternatives

[pyurin/yii2-redis-ha

Basic redis-ha client

18272.7k](/packages/pyurin-yii2-redis-ha)

PHPackages © 2026

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