Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on May 7, 2020. It is now read-only.

yankewei/laravel-sensitive

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

3 Commits

Repository files navigation

Laravel-sensitive

Sensitive Fliter for Laravel5 / Lumen based on tuyuwei/SensitiveWord.

Install

composer require yankewei/laravel-sensitive

For Laravel

Add the following line to the section providers of config/app.php:

'providers' => [
 //...
 Yankewei\LaravelSensitive\SensitiveServiceProvider::class,
],

as optional, you can use facade:

'aliases' => [
 //...
 'Sensitive' => Yankewei\LaravelSensitive\Facades\Sensitive::class,
],

For Lumen

Add the following line to bootstrap/app.php after // $app->withEloquent();

...
// $app->withEloquent();
$app->register(Yankewei\LaravelSensitive\SensitiveServiceProvider::class);
...

Usage

Using facade:

$interference = ['&', '*'];
$filename = './words.txt'; //每个敏感词独占一行
Sensitive::interference($interference); //添加干扰因子
Sensitive::addwords($filename); //需要过滤的敏感词
$txt = "我说的日本册,滚&蛋不是。。。";
$words = Sensitive::filter($txt);
dd($words);
"我说的**册,***不是。。。"

License

MIT

About

过滤敏感词汇的laravel包,使用DFA算法

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

AltStyle によって変換されたページ (->オリジナル) /