PHPackages                             bscheshirwork/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. [Database &amp; ORM](/categories/database)
4. /
5. bscheshirwork/yii2-redis-session

ActiveYii2-extension[Database &amp; ORM](/categories/database)

bscheshirwork/yii2-redis-session
================================

Yii2 session based on Redis, can separate session by user

1517.3k↓15.6%6[1 issues](https://github.com/bscheshirwork/yii2-redis-session/issues)PHP

Since Jan 30Pushed 8y ago2 watchersCompare

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

READMEChangelogDependenciesVersions (1)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

29

—

LowBetter than 57% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity34

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

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.

### Community

Maintainers

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

---

Top Contributors

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

### Embed Badge

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

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k117.2M118](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[pgvector/pgvector

pgvector support for PHP

198741.5k12](/packages/pgvector-pgvector)[jfelder/oracledb

Oracle DB driver for Laravel

11518.4k](/packages/jfelder-oracledb)

PHPackages © 2026

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