PHPackages                             bvtvd/words-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. bvtvd/words-filter

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

bvtvd/words-filter
==================

dirty words filter

1.0.2(7y ago)13.0kMITPHPPHP &gt;=5.4.0

Since Aug 7Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bvtvd/words-filter)[ Packagist](https://packagist.org/packages/bvtvd/words-filter)[ RSS](/packages/bvtvd-words-filter/feed)WikiDiscussions master Synced today

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

敏感词过滤器, 支持中文

安装:

```
composer require bvtvd/words-filter

```

使用:

```
use bvtvd\Filter;

$text = '你的观点很新颖, 但是从历史的维度看, 还存在狭隘的内部缺陷! to be or not to be, that's a question!';

$dict = ['观点', '内部缺陷', 'be'];

# 基本使用
$filter = new Filter($text, $dict);
echo $filter->clean();
//output: 你的*很新颖, 但是从历史的维度看, 还存在狭隘的*! to * or not to *, that's a question!

# 自定义替换字符
$blocker = '@';
$filter->blocker($blocker);
echo $filter->clean();
//output: 你的@很新颖, 但是从历史的维度看, 还存在狭隘的@! to @ or not to @, that's a question!

# 也可以在初始化的时候直接设置替换字符
$filter = new Filter($text, $dict, $blocker);

#  设置文本
$filter->text($text);
# 设置敏感词
$fitler->dict($dict);

# 你也可以设置不用的替换模式
$filter->model('preg');     // ['default', 'preg']
// preg 模式会替换为对应字符长度的 blocker

# 检查是否包含敏感词
$filter->check()
```

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

Established project with proven stability

 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 ~3 days

Total

3

Last Release

2877d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/23225b6e0e0176f501075de6474706f023b4ae9b5956a1a0b3f796b0c7087e85?d=identicon)[bvtvd](/maintainers/bvtvd)

---

Top Contributors

[![bvtvd](https://avatars.githubusercontent.com/u/18694985?v=4)](https://github.com/bvtvd "bvtvd (13 commits)")

---

Tags

wordsfilterdirty

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/bvtvd-words-filter/health.svg)

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

###  Alternatives

[clue/stream-filter

A simple and modern approach to stream filtering in PHP

1.7k271.5M8](/packages/clue-stream-filter)[laminas/laminas-filter

Programmatically filter and normalize data and files

9529.5M173](/packages/laminas-laminas-filter)[friendsofcake/search

CakePHP Search plugin using PRG pattern

1712.1M47](/packages/friendsofcake-search)[htmlawed/htmlawed

Official htmLawed PHP library for HTML filtering

411.2M12](/packages/htmlawed-htmlawed)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45864.7k3](/packages/outl1ne-nova-multiselect-filter)[outl1ne/nova-input-filter

An input filter for Laravel Nova

24952.5k](/packages/outl1ne-nova-input-filter)

PHPackages © 2026

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