PHPackages                             haveyb/redis-helper - 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. haveyb/redis-helper

ActiveLibrary[Caching](/categories/caching)

haveyb/redis-helper
===================

PHP使用Redis的快速上手composer包

v1.1(6y ago)136MITPHPPHP &gt;=7.1

Since Mar 10Pushed 6y ago1 watchersCompare

[ Source](https://github.com/haveyb/redis-helper)[ Packagist](https://packagist.org/packages/haveyb/redis-helper)[ RSS](/packages/haveyb-redis-helper/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (2)Used By (0)

PHP 使用 redis 辅助包
================

[](#php-使用-redis-辅助包)

1、说明

很多人对 redis 里的很多方法不是很熟悉，可能就会导致使用不恰当的方法去完成一个功能。

鉴于此，写了这个composer包，拿来即用。其中，对redis的所有方法进行了分类、封装和注释，使能够非常清晰的看到每个方法的作用。

使用方法很简单，只要正确的composer 自动加载，即可使用。

2、配置：

在 src / RedisInstance.php 中配置好下面几个参数即可。

```
define('REDIS_HOST', '127.0.0.1');
define('REDIS_PASSWORD', '');
define('REDIS_PORT', 6379);

```

3、使用示例：

```
RedisHelper::set('age', 18)
```

```
RedisHelper::del(['city', 'username', 'sex'])
```

```
RedisHelper::rename('city', 'area')
```

4、部分源代码

可以很清晰的看到每个方法的作用

```
/**
     * 获取key所储存的字符串值的长度（当key储存的不是字符串值时，返回false）
     *
     * @param $key
     * @return int
     * RedisHelper::strLen('age')
     */
    public static function strLen($key)
    {
        return RedisInstance::get()->strLen($key);
    }

    /**
     * 返回存储在指定key中字符串的子字符串。字符串的截取范围由start和end两个偏移量决定(包括start和end在内)
     *
     * @param string $key
     * @param int $start
     * @param int $end
     * @return string
     * RedisHelper::set('website', 'https://www.haveyb.com');
     * RedisHelper::getRange('website', 1, 5) // ttps:
     */
    public static function getRange($key, $start, $end)
    {
        return RedisInstance::get()->getRange($key, $start, $end);
    }

```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

2254d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e26307248e2784b57bfbc13f74768e7799f5fb30c209b4aa33e49b7a921e7b4?d=identicon)[haveyb](/maintainers/haveyb)

---

Top Contributors

[![haveyb](https://avatars.githubusercontent.com/u/56058144?v=4)](https://github.com/haveyb "haveyb (5 commits)")

### Embed Badge

![Health badge](/badges/haveyb-redis-helper/health.svg)

```
[![Health](https://phpackages.com/badges/haveyb-redis-helper/health.svg)](https://phpackages.com/packages/haveyb-redis-helper)
```

###  Alternatives

[predis/predis

A flexible and feature-complete Redis/Valkey client for PHP.

7.8k305.7M2.4k](/packages/predis-predis)[snc/redis-bundle

A Redis bundle for Symfony

1.0k39.4M67](/packages/snc-redis-bundle)[react/cache

Async, Promise-based cache interface for ReactPHP

444112.4M40](/packages/react-cache)[wp-media/wp-rocket

Performance optimization plugin for WordPress

7431.3M3](/packages/wp-media-wp-rocket)[illuminate/cache

The Illuminate Cache package.

12835.6M1.4k](/packages/illuminate-cache)[colinmollenhour/php-redis-session-abstract

A Redis-based session handler with optimistic locking

6325.6M14](/packages/colinmollenhour-php-redis-session-abstract)

PHPackages © 2026

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