PHPackages                             phpch/imi-sensitive-word-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. phpch/imi-sensitive-word-filter

ActiveLibrary

phpch/imi-sensitive-word-filter
===============================

基于IMI的dfa敏感词过滤

v1.0.1(2y ago)411MITPHPPHP &gt;=7.4

Since Jul 25Pushed 2y ago2 watchersCompare

[ Source](https://github.com/z83760037/imi-sensitive-word-filter)[ Packagist](https://packagist.org/packages/phpch/imi-sensitive-word-filter)[ RSS](/packages/phpch-imi-sensitive-word-filter/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (0)

imi-sensitive-word-filter
=========================

[](#imi-sensitive-word-filter)

基于IMI的dfa敏感词过滤

安装：composer require phpch/imi-sensitive-word-filter

#### 你需要添加的配置

[](#你需要添加的配置)

```
'SensitiveWordFilter' => [
		'type' => 'mysql', // array,file, mysql
		'matchType' => 1, // 1:最小匹配规则，如：敏感词库["中国","中国人"]，语句："我是中国人"，匹配结果：我是[中国]人,2:最大匹配规则，如：敏感词库["中国","中国人"]，语句："我是中国人"，匹配结果：我是[中国人]
		'array' => [
			"中国",
			"中国人"
		],// 敏感词列表
		'mysql' => [
			'model' => \ImiApp\ApiServer\Model\EkSensitiveWord::class, // 模型名称
			'field' => 'word', // 敏感词字段
		],
		'file' => [],// 文件列表
		'disturbList'=>['&','-'], // 干扰因子集合
	],

```

### 检测是否含有敏感词

[](#检测是否含有敏感词)

```
$islegal = SensitiveWordFilterUtil::contains($content);

```

### 敏感词过滤

[](#敏感词过滤)

```
// 敏感词替换为*为例（会替换为相同字符长度的*）
$filterContent =SensitiveWordFilterUtil::replace($content, '*');

 // 或敏感词替换为***为例
 $filterContent =SensitiveWordFilterUtil::replace($content, '***', false);

```

### 标记敏感词

[](#标记敏感词)

```
 $markedContent = SensitiveWordFilterUtil::mark($content, '', '');

```

### 获取文字中的敏感词

[](#获取文字中的敏感词)

```
// 获取内容中所有的敏感词
$sensitiveWordGroup =SensitiveWordFilterUtil::getBadWord($content);
// 仅且获取一个敏感词
$sensitiveWordGroup = SensitiveWordFilterUtil::getBadWord($content, 1);

```

###  Health Score

23

—

LowBetter than 27% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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 ~1 days

Total

2

Last Release

1026d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3732c6567767cd78eceed636f39cbb5d1b9ff8e3c667171492fcffe611e9c16b?d=identicon)[z83760037](/maintainers/z83760037)

---

Top Contributors

[![765264087](https://avatars.githubusercontent.com/u/167863322?v=4)](https://github.com/765264087 "765264087 (8 commits)")[![z83760037](https://avatars.githubusercontent.com/u/50696684?v=4)](https://github.com/z83760037 "z83760037 (1 commits)")

### Embed Badge

![Health badge](/badges/phpch-imi-sensitive-word-filter/health.svg)

```
[![Health](https://phpackages.com/badges/phpch-imi-sensitive-word-filter/health.svg)](https://phpackages.com/packages/phpch-imi-sensitive-word-filter)
```

PHPackages © 2026

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