PHPackages                             zz98500/php-dfa-sensitive - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. zz98500/php-dfa-sensitive

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

zz98500/php-dfa-sensitive
=========================

To achieve the filtering of sensitive words, based on the determination of finite automata (DFA) algorithm.

0691PHP

Since Dec 21Pushed 8y agoCompare

[ Source](https://github.com/zz98500/php-dfa-sensitive)[ Packagist](https://packagist.org/packages/zz98500/php-dfa-sensitive)[ RSS](/packages/zz98500-php-dfa-sensitive/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

php-DFA-filterWord
==================

[](#php-dfa-filterword)

php实现基于确定有穷自动机算法的铭感词过滤

安装&amp;使用流程
-----------

[](#安装使用流程)

### Download and install Composer:

[](#download-and-install-composer)

```
curl -sS https://getcomposer.org/installer | php

```

> 要检查 Composer 是否正常工作，只需要通过 php 来执行 PHAR

```
php composer.phar

```

### 安装扩展

[](#安装扩展)

```
composer require zz98500/php-dfa-sensitive

```

- 注意:如果你在使用composer安装时，出现
    Could not find package lustre/php-dfa-sensitive at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability 请在你的composer.json中加入`"minimum-stability": "dev"`

#### 如果你需要手动引入

[](#如果你需要手动引入)

```
require './vendor/autoload.php';

use DfaFilter\SensitiveHelper;

```

### 获取影响因子

[](#获取影响因子)

```
// 获取影响因子数组
$interferenceData = array(
    '#',
    '，',
    '~',
    '-',
    '/',
    ......
);

```

### 获取敏感词库

[](#获取敏感词库)

```
// 获取感词库索引数组
$wordData = array(
    '察象蚂',
    '拆迁灭',
    '车牌隐',
    '成人电',
    '成人卡通',
    ......
);

```

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

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

```
$islegal = SensitiveHelper::init()->setInterference($interference)->setTree($wordData)->islegal($content);

```

### 敏感词过滤

[](#敏感词过滤)

```
// 敏感词替换为***为例
$filterContent = SensitiveHelper::init()->setInterference($interference)->setTree($wordData)->replace($content, '***');

```

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

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

```
// 获取内容中所有的敏感词
$sensitiveWordGroup = SensitiveHelper::init()->setInterference($interference)->setTree($wordData)->getBadWord($content);
// 仅且获取一个敏感词
$sensitiveWordGroup = SensitiveHelper::init()->setInterference($interference)->setTree($wordData)->getBadWord($content, 1);

```

目前已知使用平台：[广电云](http://www.guangdianyun.tv/) 节目直播页面在线聊天功能支持

*如果大家有更好的建议，请大家多多指正，O(∩\_∩)O谢谢*

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

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

### Community

Maintainers

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

---

Top Contributors

[![FireLustre](https://avatars.githubusercontent.com/u/16452711?v=4)](https://github.com/FireLustre "FireLustre (18 commits)")[![zedisdog](https://avatars.githubusercontent.com/u/8280666?v=4)](https://github.com/zedisdog "zedisdog (6 commits)")[![zz98500](https://avatars.githubusercontent.com/u/21366563?v=4)](https://github.com/zz98500 "zz98500 (2 commits)")

### Embed Badge

![Health badge](/badges/zz98500-php-dfa-sensitive/health.svg)

```
[![Health](https://phpackages.com/badges/zz98500-php-dfa-sensitive/health.svg)](https://phpackages.com/packages/zz98500-php-dfa-sensitive)
```

###  Alternatives

[webtoolsnz/yii2-scheduler

A scheduled task runner for Yii2 applications

1883.6k](/packages/webtoolsnz-yii2-scheduler)

PHPackages © 2026

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