PHPackages                             postor/yii2-redis-filter - 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. postor/yii2-redis-filter

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

postor/yii2-redis-filter
========================

ordering,paging,categorizing your items use via sorted set

1.1.1(6y ago)1181[1 PRs](https://github.com/postor/yii2-redis-filter/pulls)BSD-3-ClausePHP

Since Dec 5Pushed 3y ago1 watchersCompare

[ Source](https://github.com/postor/yii2-redis-filter)[ Packagist](https://packagist.org/packages/postor/yii2-redis-filter)[ RSS](/packages/postor-yii2-redis-filter/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

yii2-redis-filter
=================

[](#yii2-redis-filter)

ordering,paging,categorizing your items use via sorted set 利用redis的有序集合实现排序、分页、分类

quick glance: [https://www.youtube.com/watch?v=zLYAlfSTUQE&amp;list=PLM1v95K5B1ntVsYvNJIxgRPppngrO\_X4s](https://www.youtube.com/watch?v=zLYAlfSTUQE&list=PLM1v95K5B1ntVsYvNJIxgRPppngrO_X4s)

install安装
---------

[](#install安装)

```
php composer.phar require --prefer-dist postor/yii2-redis-filter

```

config配置
--------

[](#config配置)

```
'components' => [
        ....,
        'redis' => [
	        'class' => 'yii\redis\Connection',
	        'hostname' => REDIS_HOST,
	        'port' => REDIS_PORT,
	        'database' => REDIS_DB,
        ],
        'redisfilter'=>[
          'class'=>'postor\redisfilter\RedisFilter',
          'redis'=>'redis',
        ],
        ....

```

usage使用
-------

[](#usage使用)

\\Yii::$app-&gt;redisfilter-&gt;getTagList($tag,$offset,$limit); $tag param：

- string, just the tag set 字符串就是对应的tag集合
- array, deep loop each array and interstore key and value, then unionstore all element results. 数组情况则key与value取交集，然后所有数组元素取并集，可以嵌套

\['a','b'=&gt;\['c'=&gt;\['d','e'=&gt;'f'\]\]\] means a|(b&amp;c&amp;(d|(e&amp;f))

```
//set tags 设置标签
$rf = \Yii::$app->redisfilter;
$rf->setTag($a->id, 'base', $a->created_time); //all article sort by created_time 所有文章按时间排序
$rf->setTag($a->id, 'samsung'); //all article tag into tag sets 所有文章按标签类型贴收入对应集合
$rf->removeTag($b->id, 'base');

//filter tags 筛选标签
//by page 按分页
$ids = $rf->getTagList(['seta','setb'=>'setc'],$offset,$pageSize); // seta|(setb&setc)
//$ids  array(11) { [0]=> string(7) "1385584" [1]=> string(7) "1385585" [2]=> string(7) "1385586" [3]=> string(7) "1385587" [4]=> string(7) "1385588" [5]=> string(7) "1385589" [6]=> string(7) "1515910" [7]=> string(7) "1515911" [8]=> string(7) "1515912" [9]=> string(7) "1515913" [10]=> string(7) "1515914" }

//by score 按分数
$zsetname = $rf->getZset(['base'=>'samsung']); // base&samsung
$total = $rf->getTagTotalByZset($zsetname);
$ids = $rf->getTagListByScore($zsetname, time()-86400*3, time());

```

example
-------

[](#example)

```
cd example

# config your own redis
vi config/web.php

./yii serve

```

open localhost:8080 and try

for details see codes: [example/models/NumberFilter.php](./example/models/NumberFilter.php)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 86.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.

###  Release Activity

Cadence

Every ~496 days

Total

4

Last Release

2370d ago

Major Versions

0.1 → 1.02015-12-11

### Community

Maintainers

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

---

Top Contributors

[![postor](https://avatars.githubusercontent.com/u/699002?v=4)](https://github.com/postor "postor (13 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (2 commits)")

---

Tags

redisyii2redisfilteryii2yii 2

### Embed Badge

![Health badge](/badges/postor-yii2-redis-filter/health.svg)

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

###  Alternatives

[bazilio/yii2-async

Provides translucent api for moving large tasks out of request context

6249.6k2](/packages/bazilio-yii2-async)[pyurin/yii2-redis-ha

Basic redis-ha client

18283.8k](/packages/pyurin-yii2-redis-ha)

PHPackages © 2026

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