PHPackages                             vaszloy/yii2-redis-session - 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. vaszloy/yii2-redis-session

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

vaszloy/yii2-redis-session
==========================

Yii2 session based on Redis, can separate session by user

1.0.1(6y ago)06BSD-3-ClausePHPPHP &gt;=7.1.0

Since May 8Pushed 6y agoCompare

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

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

yii2-redis-session
==================

[](#yii2-redis-session)

Based on [yii2-redis](https://github.com/yiisoft/yii2-redis) session. Can remove user's sessions by user identity id. Can get a online users.

Redis Session implements a session component using [redis](http://redis.io/) as the storage medium.

Redis Session requires redis version 3.0.2 or higher to work properly.

It needs to be configured with a redis \[\[Connection\]\] that is also configured as an application component.

By default it will use the `redis` application component (see [yii2-redis](https://github.com/yiisoft/yii2-redis) for more info).

```
[
    'components' => [
        'redis' => [
            'class' => 'yii\redis\Connection',
            'hostname' => 'localhost',
            'port' => 6379,
            'database' => 0,
        ],
    ]
]
```

To use redis Session as the session application component, configure the application as follows,

```
[
   'components' => [
       'session' => [
           'class' => 'bscheshirwork\redis\Session',
           // 'redis' => 'redis' // id of the connection application component
       ],
   ],
]
```

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

[](#installation)

Add

```
    "bscheshirwork/yii2-redis-session": "*@dev",

```

into your `composer.json` `require` section.

Functional
----------

[](#functional)

Get all online user's

```
\Yii::$app->session->getOnlineUsers();
```

Get all active session by user

```
\Yii::$app->session->getSessionsById($userIdentityId);
```

Remove all active session by user

```
\Yii::$app->session->destroyUserSessions($userIdentityId);
```

Get all active sessions

```
\Yii::$app->session->getActiveSessions();
```

Tests
-----

[](#tests)

See [this (ru)](./docs/tests.md) guide for create PHPUnit suite

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

2195d ago

### Community

Maintainers

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

---

Top Contributors

[![bscheshirwork](https://avatars.githubusercontent.com/u/5769211?v=4)](https://github.com/bscheshirwork "bscheshirwork (17 commits)")

---

Tags

redissessionyii

### Embed Badge

![Health badge](/badges/vaszloy-yii2-redis-session/health.svg)

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

###  Alternatives

[jrschumacher/symfony-redis-session-handler

Redis Session Handler Symfony HttpFoundation Component

1261.1k](/packages/jrschumacher-symfony-redis-session-handler)[craftsys/laravel-redis-session-enhanced

Enhanced redis driver for sessions in Laravel

106.6k](/packages/craftsys-laravel-redis-session-enhanced)[dmitry-suffi/redis-session-handler

Обработчик сессий через Redis с механизмом блокировки

112.9k](/packages/dmitry-suffi-redis-session-handler)

PHPackages © 2026

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