定制 evo-mark/evo-laravel-profanity 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

evo-mark/evo-laravel-profanity

最新稳定版本:v1.1.1

Composer 安装命令:

composer require evo-mark/evo-laravel-profanity

包简介

Use Pest's profanity wordlist in your validator

README 文档

README

evoMark company logo

Build status Total Downloads Licence

Evo Laravel Profanity

This package provides a profanity validation rule that draws on the words made available in the Pest Profanity package.

Installation

You can install the package via composer:

composer require evo-mark/evo-laravel-profanity

You can publish the config file with:

php artisan vendor:publish --tag="evo-laravel-profanity-config"

Finally, to download/update the profanity definitions, add this to the composer.json file at the root of your project:

"scripts": {
    "post-autoload-dump": [
        "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
        "@php artisan profanity:update"
    ],
}

Caution

Failure to add the above will result in validation not running with the rule.

Usage

The validator uses your current locale for determining which profanity words to check against. Alternatively, you can set this manually in your config file. See the Pest repository for available locales.

To use the validator, simply include the profanity rule in your ruleset.

You can include/exclude additional words by publishing the config and adding them there, e.g.

return [
    'includingWords' => [
        'en' => ['soccer']
    ],
    'excludingWords' => [
        'en' => []
    ]
];

On failure, the validator will return the message in your lang/{locale}/validation file under the profanity property.

public function store(Request $request)
{
    $validated = $request->validate([
        'email' => ['required', 'string', 'email'],
        'first_name' => ['required', 'string', 'profanity'],
    ]);
}

Support Open-Source Software

We're providing this package free-of-charge. However, all development and maintenance costs time, energy and money. So please help fund this project if you can.

Buy Me A Coffee

Changelog

Please see CHANGELOG for more information on what has changed recently.

Licence

The MIT Licence (MIT). Please see Licence File for more information.

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-02