PHPackages                             divineomega/laravel-offensive-validation-rule - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. divineomega/laravel-offensive-validation-rule

Abandoned → [jord-jd/laravel-offensive-validation-rule](/?search=jord-jd%2Flaravel-offensive-validation-rule)Library[Validation &amp; Sanitization](/categories/validation)

divineomega/laravel-offensive-validation-rule
=============================================

Laravel validation rule that checks if a string is offensive.

v2.0.0(6mo ago)132701LGPL-3.0-onlyPHPPHP ^7.2 || ^8.0CI passing

Since May 7Pushed 4w agoCompare

[ Source](https://github.com/Jord-JD/laravel-offensive-validation-rule)[ Packagist](https://packagist.org/packages/divineomega/laravel-offensive-validation-rule)[ GitHub Sponsors](https://github.com/DivineOmega)[ RSS](/packages/divineomega-laravel-offensive-validation-rule/feed)WikiDiscussions master Synced 4w ago

READMEChangelog (6)Dependencies (3)Versions (6)Used By (1)

🤬🤭 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.

[![Laravel Offensive Validation Rule usage](assets/images/laravel-offensive-validation-rule-usage.png)](assets/images/laravel-offensive-validation-rule-usage.png)

[![Tests](https://github.com/Jord-JD/laravel-offensive-validation-rule/actions/workflows/tests.yml/badge.svg)](https://github.com/Jord-JD/laravel-offensive-validation-rule/actions/workflows/tests.yml)

Installation
------------

[](#installation)

To install, just run the following Composer command.

```
composer require jord-jd/laravel-offensive-validation-rule

```

The package supports Illuminate/Laravel 5.5 through 13 and PHP 7.1 through current PHP 8.x releases.

Usage
-----

[](#usage)

The following code snippet shows an example of how to use the offensive validation rule.

```
use JordJD\LaravelOffensiveValidationRule\Offensive;

$request->validate([
    'username' => ['required', new Offensive],
]);
```

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

[](#custom-validation-message)

Pass an optional message as the second constructor argument. Laravel replaces `:attribute` as usual.

```
$request->validate([
    'username' => [
        'required',
        'string',
        new Offensive(null, 'Please choose a different :attribute.'),
    ],
]);
```

### Custom word lists

[](#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.

```
use JordJD\LaravelOffensiveValidationRule\Offensive;
use JordJD\IsOffensive\OffensiveChecker;

$blacklist = ['moist', 'stinky', 'poo'];
$whitelist = ['poop'];

$rule = new Offensive(
    new OffensiveChecker($blacklist, $whitelist),
    'Please choose a different :attribute.'
);

$request->validate(['username' => ['required', 'string', $rule]]);
```

###  Health Score

50

—

FairBetter than 95% of packages

Maintenance83

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 97.4% 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 ~710 days

Total

5

Last Release

181d ago

Major Versions

v1.3.0 → v2.0.02026-02-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/c580cdf7c14898fff179cdfc1085892091d5d2f49d917873a12365af9ac77c93?d=identicon)[Jord-JD](/maintainers/Jord-JD)

---

Top Contributors

[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (37 commits)")[![marcreichel](https://avatars.githubusercontent.com/u/7645035?v=4)](https://github.com/marcreichel "marcreichel (1 commits)")

---

Tags

laravellaravel-5-packagelaravel-validationoffensiveoffensive-languagephp

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/divineomega-laravel-offensive-validation-rule/health.svg)

```
[![Health](https://phpackages.com/badges/divineomega-laravel-offensive-validation-rule/health.svg)](https://phpackages.com/packages/divineomega-laravel-offensive-validation-rule)
```

###  Alternatives

[illuminate/validation

The Illuminate Validation package.

18838.8M2.0k](/packages/illuminate-validation)[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[moonshine/moonshine

Laravel administration panel

1.3k268.2k88](/packages/moonshine-moonshine)[illuminate/json-schema

The Illuminate Json Schema package.

262.9M21](/packages/illuminate-json-schema)[tallstackui/tallstackui

TallStackUI is a powerful suite of Blade components that elevate your workflow of Livewire applications.

731189.9k16](/packages/tallstackui-tallstackui)[sandermuller/laravel-fluent-validation

Fluent validation rule builders for Laravel

21428.9k6](/packages/sandermuller-laravel-fluent-validation)

PHPackages © 2026

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