PHPackages                             bootell/yii2-phpredis - 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. bootell/yii2-phpredis

ActiveLibrary[Caching](/categories/caching)

bootell/yii2-phpredis
=====================

Redis Cache, Session and ActiveRecord for the Yii2 Using PhpRedis

52685[2 issues](https://github.com/bootell/yii2-phpredis/issues)PHPCI failing

Since Jun 22Pushed 4y ago2 watchersCompare

[ Source](https://github.com/bootell/yii2-phpredis)[ Packagist](https://packagist.org/packages/bootell/yii2-phpredis)[ RSS](/packages/bootell-yii2-phpredis/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

 [ ![](https://camo.githubusercontent.com/9d4fc545d7f42044ee5afaee43cf1baa8735dcd8301332b953b39bf19f6931d6/687474703a2f2f646f776e6c6f61642e72656469732e696f2f72656469732e706e67) ](http://redis.io/)

Yii 2 Redis extension using PhpRedis
====================================

[](#yii-2-redis-extension-using-phpredis)

The original [yiisoft/yii2-redis](https://github.com/yiisoft/yii2-redis) extension uses socket to communicate. It has performance issues in high concurrency: long response time, and `Failed to read from socket` error. Instead of using the socket, this extension uses the [phpredis](https://github.com/phpredis/phpredis) to connect to redis server, and all classes and methods has save input and output as the original extension.

Yii 原始的 [yiisoft/yii2-redis](https://github.com/yiisoft/yii2-redis) 扩展使用 socket 进行通信，在高并发下有性能问题，响应时间较长，并且会出现 `Failed to read from socket` 错误。

本扩展在原有 yii2-redis 的基础上，将连接方式替换为使用 php 原生扩展 [phpredis/phpredis](https://github.com/phpredis/phpredis)，性能大幅提高的同时，保持与原有扩展相同的调用方法方式，支持 Cache/Session/ActiveRecord，仅需替换对应类即可。

安装
--

[](#安装)

```
php composer.phar require --prefer-dist bootell/yii2-phpredis:"*"

```

配置
--

[](#配置)

```
return [
    //....
    'components' => [
        'redis' => [
            'class' => bootell\Yii2\redis\Connection::class,
            'hostname' => 'localhost',
            'port' => 6379,
            'database' => 0,
        ],
    ]
];
```

说明
--

[](#说明)

- [phpredis](https://github.com/phpredis/phpredis) 不支持配置超时重试次数 `retries`，但可配置重试间隔 `retry_interval`；

###  Health Score

18

—

LowBetter than 7% of packages

Maintenance12

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 85.7% 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://www.gravatar.com/avatar/1aa009e27686b530f6f8f30e7b1a541c936b7fbca509dfe778d97f0f8fe1dcaa?d=identicon)[Brooks Bao](/maintainers/Brooks%20Bao)

---

Top Contributors

[![bootell](https://avatars.githubusercontent.com/u/6562023?v=4)](https://github.com/bootell "bootell (6 commits)")[![ondrejvrabel](https://avatars.githubusercontent.com/u/30723938?v=4)](https://github.com/ondrejvrabel "ondrejvrabel (1 commits)")

### Embed Badge

![Health badge](/badges/bootell-yii2-phpredis/health.svg)

```
[![Health](https://phpackages.com/badges/bootell-yii2-phpredis/health.svg)](https://phpackages.com/packages/bootell-yii2-phpredis)
```

###  Alternatives

[iazaran/smart-cache

Smart Cache is a caching optimization package designed to enhance the way your Laravel application handles data caching. It intelligently manages large data sets by compressing, chunking, or applying other optimization strategies to keep your application performant and efficient.

21114.2k](/packages/iazaran-smart-cache)[phpfastcache/phpssdb

PHP SSDB Driver for phpFastCache

14736.9k1](/packages/phpfastcache-phpssdb)[rapidwebltd/rw-file-cache

RW File Cache is a PHP File-based Caching Library. Its syntax is designed to closely resemble the PHP memcache extension.

15196.8k7](/packages/rapidwebltd-rw-file-cache)[yuzuru-s/redis-recommend

Wrapping Redis's sorted set APIs for specializing recommending operations.

392.9k](/packages/yuzuru-s-redis-recommend)[ichhabrecht/intcache

Turn uncachable page objects into cacheable links

193.9k](/packages/ichhabrecht-intcache)

PHPackages © 2026

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