PHPackages                             xiaowei/model\_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. [Search &amp; Filtering](/categories/search)
4. /
5. xiaowei/model\_filter

ActiveLibrary[Search &amp; Filtering](/categories/search)

xiaowei/model\_filter
=====================

model filter for hyperf

1.1.0(6y ago)2591MITPHPPHP &gt;=7.2

Since Apr 24Pushed 6y ago1 watchersCompare

[ Source](https://github.com/xiaoweiTu/modelFilter)[ Packagist](https://packagist.org/packages/xiaowei/model_filter)[ RSS](/packages/xiaowei-model-filter/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (7)Versions (7)Used By (0)

modelFilter
===========

[](#modelfilter)

习惯了laravel的[tucker-eric/eloquentfilter](https://github.com/Tucker-Eric/EloquentFilter)查询条件写法， 转到hyperf发现没有相关的包,所以这个包出现了。

支持hyperf1.1

如何使用
====

[](#如何使用)

```
 安装最新版

 composer require xiaowei/model_filter --prefer-dist

 创建目录
 app/ModelFilters

 在模型中使用trait

 use Xiaowei\ModelFilter\Filterable;
 class Tag extends Model
 {
    use Filterable;
 }

 创建filter类

 在app/ModelFilters中创建模型名+filter的文件

use Xiaowei\ModelFilter\ModelFilter;
class TagFilter extends ModelFilter
{
    public function id($value)
    {
        $this->where('id',$value);
    }

    public function name($value)
    {
        $this->where('name','like',$value.'%');
    }

    public function order($value)
    {
        $this->where('order','>=',$value);
    }
}

```

注意
--

[](#注意)

1. 目前只支持Hyperf\\Database\\Model\\Builder中的查询方法
2. 参数需要为下划线分割的名称 如 product\_id 那么ModelFilter中对应的方法就为productId

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity55

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

Every ~0 days

Total

6

Last Release

2215d ago

### Community

Maintainers

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

---

Top Contributors

[![xiaoweiTu](https://avatars.githubusercontent.com/u/24858632?v=4)](https://github.com/xiaoweiTu "xiaoweiTu (7 commits)")

---

Tags

phpfilterhyperf

###  Code Quality

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/xiaowei-model-filter/health.svg)

```
[![Health](https://phpackages.com/badges/xiaowei-model-filter/health.svg)](https://phpackages.com/packages/xiaowei-model-filter)
```

###  Alternatives

[hyperf-ext/scout

The Hyperf Scout package.

106.7k](/packages/hyperf-ext-scout)

PHPackages © 2026

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