PHPackages                             coxlr/laravel-profanity - 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. coxlr/laravel-profanity

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

coxlr/laravel-profanity
=======================

A Laravel package to find and remove profanity from text strings.

1.2.0(1y ago)12.2k↓47.6%MITPHPPHP ^8.1CI passing

Since Mar 9Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/coxlr/laravel-profanity)[ Packagist](https://packagist.org/packages/coxlr/laravel-profanity)[ Docs](https://github.com/coxlr/laravel-profanity)[ RSS](/packages/coxlr-laravel-profanity/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (3)Dependencies (4)Versions (5)Used By (0)

A Laravel package to find and remove profanity from text strings.
=================================================================

[](#a-laravel-package-to-find-and-remove-profanity-from-text-strings)

[![Latest Version on Packagist](https://camo.githubusercontent.com/331e559800d73b4a582989c8c9e6d0da73cab6eb90f56366fcf98c80ab2d42c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f636f786c722f6c61726176656c2d70726f66616e6974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/coxlr/laravel-profanity)[![Tests](https://github.com/coxlr/laravel-profanity/actions/workflows/run-tests.yml/badge.svg)](https://github.com/coxlr/laravel-profanity/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/350ef7529ffa144b05af3f02c0f44ed5a26c98f5d7186f3e98e6bd6167d96b3c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f636f786c722f6c61726176656c2d70726f66616e6974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/coxlr/laravel-profanity)

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

[](#installation)

This package requires PHP 8.1 and Laravel 10 or higher.

To install the PHP client library using Composer:

```
composer require coxlr/laravel-profanity
```

The package will automatically register the `Profanity` provider and facade.

You can publish the config file with:

```
php artisan vendor:publish --provider="Coxlr\Profanity\ProfanityServiceProvider" --tag="config"
```

Then update `config/profanity.php` with your credentials. Alternatively, you can update your `.env` file with the following:

```
PROFANITY_REPLACEMENT_CHARACTER=*
PROFANITY_REPLACEMENT_LENGTH=4
PROFANITY_REPLACEMENT_LANGUAGES=en,es
```

Usage
-----

[](#usage)

To use Profanity you can use the facade, or request the instance from the service container.

### Clean a string

[](#clean-a-string)

```
$cleansedText = Profanity::clean('Using the facade to cleanse a string.');

/*
  This function returns a string with any profanity found replaced with replace value set in the config.
*/
```

Or

```
$profanity = app('profanity');

$cleansedText = $profanity->clean('Using the instance to cleanse a string.');
```

### Check if a string is clean or not

[](#check-if-a-string-is-clean-or-not)

```
$isClean = Profanity::isClean('The string to be checked.');

/*
  This function returns a boolean value. If the string is clean, it will return true. If the string contains profanity, it will return false.
*/
```

### To set the languages to use when searching for profanity

[](#to-set-the-languages-to-use-when-searching-for-profanity)

```
$cleansedText = Profanity::setLanguages('en,es,fr')->clean('The string to be cleansed.');
```

### To set strict mode when search for and replace profanity

[](#to-set-strict-mode-when-search-for-and-replace-profanity)

Strict mode will replace any profanity found even if it is found within a word, and not just the exact word.

```
$cleansedText = Profanity::setStrict(true)->clean('The string to be cleansed.');

$isClean = Profanity::setStrict(true)->isClean('The string to be checked.');
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Lee Cox](https://github.com/coxlr)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance52

Moderate activity, may be stable

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~359 days

Total

3

Last Release

446d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/8451762?v=4)[Lee](/maintainers/coxlr)[@coxlr](https://github.com/coxlr)

---

Top Contributors

[![coxlr](https://avatars.githubusercontent.com/u/8451762?v=4)](https://github.com/coxlr "coxlr (16 commits)")

---

Tags

laravelprofanitycoxlr

###  Code Quality

TestsPHPUnit

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/coxlr-laravel-profanity/health.svg)

```
[![Health](https://phpackages.com/badges/coxlr-laravel-profanity/health.svg)](https://phpackages.com/packages/coxlr-laravel-profanity)
```

###  Alternatives

[askedio/laravel5-profanity-filter

A Vendor Package Example

52354.1k](/packages/askedio-laravel5-profanity-filter)[laravel-validation-rules/us-state

Validate US States and Canada Provinces

16172.7k](/packages/laravel-validation-rules-us-state)[pacerit/laravel-polish-validation-rules

Simple Polish Validation rules for Laravel and Lumen framework

1449.9k](/packages/pacerit-laravel-polish-validation-rules)[laravel-validation-rules/ip

Validate if an ip address is public or private.

1629.7k](/packages/laravel-validation-rules-ip)[janvince/smallcontactform

Simple but flexible multi language contact form builder with custom fields, validation and passive antispam

307.4k](/packages/janvince-smallcontactform)[basillangevin/laravel-data-json-schemas

Transforms Spatie Data objects into JSON Schemas with built-in validation

1312.2k1](/packages/basillangevin-laravel-data-json-schemas)

PHPackages © 2026

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