Download the PHP package jord-jd/laravel-offensive-validation-rule without Composer
On this page you can find all versions of the php package jord-jd/laravel-offensive-validation-rule. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jord-jd/laravel-offensive-validation-rule
More information about jord-jd/laravel-offensive-validation-rule
Files in jord-jd/laravel-offensive-validation-rule
Package laravel-offensive-validation-rule
Short Description Laravel validation rule that checks if a string is offensive.
License LGPL-3.0-only
Informations about the package laravel-offensive-validation-rule
🤬🤭 Laravel Offensive Validation Rule
This package provides a Laravel validation rule that checks if a string is offensive. It can be useful to check user supplied data that may be publicly displayed, such as usernames or comments.
Installation
To install, just run the following Composer command.
The package supports Illuminate/Laravel 5.5 through 13 and PHP 7.1 through current PHP 8.x releases.
Usage
The following code snippet shows an example of how to use the offensive validation rule.
This rule only decides whether string content is offensive. Non-string values
pass so Laravel rules such as string, array, or integer can report the
appropriate type error. Objects with __toString() are checked as strings.
Custom validation message
Pass an optional message as the second constructor argument. Laravel replaces
:attribute as usual.
Custom word lists
If the defaults are too strict (or not strict enough), you can optionally specify a custom list of offensive words and custom whitelist. Below is an example of using a custom blacklist and whitelist.
All versions of laravel-offensive-validation-rule with dependencies
illuminate/contracts Version ^5.5 || ^6.0 || ^7.0 || ^8.0 || ^9.0 || ^10.0 || ^11.0 || ^12.0 || ^13.0
jord-jd/is_offensive Version ^5.0