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)036MITPHPPHP &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 today

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 30% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity52

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

2350d 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

[awssat/laravel-visits

Laravel Redis visits counter for Eloquent models

975175.4k2](/packages/awssat-laravel-visits)[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)

PHPackages © 2026

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