larva/laravel-censor
laravel-censor
适用于 Laravel 的内容安全审查扩展。
环境需求
- PHP >= 7.4
安装
composer require larva/laravel-censor -vv
使用
自动审核
use Larva\Censor\Censor;
$censor = Censor::make();
$content= '赚钱啦';
try {
$content = $censor->textCensor($content);
if($censor->isMod){
//需要审核
}
} catch (CensorNotPassedException $e) {
//有违禁词
}
表单验证
表单验证只检查是否有违禁词,需要审核的直接是放行的,使用本扩展,再用户发布内容后,建议使用队列异步审核一遍。
$request->validate([
'name' => ['required', 'string', new TextCensorRule],
]);
$request->validate([
'name' => ['required', 'string', 'text_censor'],
]);
Related Packages
linkthrow/profanityfilter
Profanity filter package would help you censor some of the bad words users put i...
111
0
sworup/profanityfilter
Profanity filter package would help you censor some of the bad words users put i...
6,738
7
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.4.4 | ^8.0 | ^8.0 | | MIT | |
| 1.4.3 | ^8.0 | ^8.0 | | MIT | |
| 1.4.2 | ^8.0 | ^8.0 | | MIT | |
| 1.4.1 | ^8.0 | ^8.0 | | MIT | |
| 1.4.0 | ^8.0 | ^8.0 | | MIT | |
| 1.3.0 | ^8.0 | ^8.0 | | MIT | |
| 1.2.2 | ^7.3| | ^6.0 | | MIT | |
| 1.2.1 | ^7.3| | ^6.0 | | MIT | |
| 1.2.0 | ^7.3| | ^6.0 | | MIT | |
| 1.1.9 | ^7.3| | ^6.0 | | MIT | |
| 1.1.8 | ^7.3| | ^6.0 | | MIT | |
| 1.1.7 | ^7.3| | ^6.0 | | MIT | |
| 1.1.6 | ^7.3| | ^6.0 | | MIT | |
| 1.1.5 | ^7.3| | ^6.0 | | MIT | |
| 1.1.4 | ^7.3| | ^6.0 | | MIT | |
| 1.1.3 | ^7.3| | ^6.0 | | MIT | |
| 1.1.2 | ^7.3| | ^6.0 | | MIT | |
| 1.1.1 | ^7.3| | ^6.0 | | MIT | |
| 1.1.0 | ^7.3| | ^6.0 | | MIT | |
| 1.0.9 | ^7.3| | ^6.0 | | MIT | |
| 1.0.8 | ^7.3| | ^6.0 | | MIT | |
| 1.0.7 | ^7.3| | ^6.0 | | MIT | |
| 1.0.6 | ^7.3| | ^6.0 | | MIT | |
| 1.0.5 | ^7.3| | ^6.0 | | MIT | |
| 1.0.4 | ^6.0 | | MIT | ||
| 1.0.3 | ^6.0 | | MIT | ||
| 1.0.2 | ^6.0 | | MIT | ||
| 1.0.1 | ^6.0 | | MIT | ||
| 1.0.0 | ^6.0 | | MIT |