PHPackages                             mofodojodino/profanity-filter - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mofodojodino/profanity-filter

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mofodojodino/profanity-filter
=============================

Filters out profanities from strings.

1.3.0(10y ago)69717.5k↓10.2%25[3 PRs](https://github.com/developerdino/ProfanityFilter/pulls)2MITPHPPHP &gt;=5.3.3CI failing

Since Sep 3Pushed 3y ago2 watchersCompare

[ Source](https://github.com/developerdino/ProfanityFilter)[ Packagist](https://packagist.org/packages/mofodojodino/profanity-filter)[ RSS](/packages/mofodojodino-profanity-filter/feed)WikiDiscussions develop Synced 1mo ago

READMEChangelog (8)Dependencies (2)Versions (11)Used By (2)

Profanity Filter
================

[](#profanity-filter)

A simple class to test if a string has a profanity in it.

Checks performed
----------------

[](#checks-performed)

### Straight matching

[](#straight-matching)

Checks string for profanity as it is against list of bad words. E.g. `badword`

### Substitution

[](#substitution)

Checks string for profanity with characters substituted for each letter. E.g. `bâdΨ0rd`

### Obscured

[](#obscured)

Checks string for profanity obscured with punctuation between. E.g. `b|a|d|w|o|r|d`

### Doubled

[](#doubled)

Check string for profanity that has characters doubled up. E.g. `bbaaddwwoorrdd`

### Combinations

[](#combinations)

Also works with combinations of the above. E.g. `b|â|d|Ψ|0|rr|d`

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

[](#installation)

Install this package via composer.

```
php composer.phar require developer/profanity-filter

```

Usage
-----

[](#usage)

```
/* default constructor */
$check = new Check();
$hasProfanity = $check->hasProfanity($badWords);
$cleanWords = $check->obfuscateIfProfane($badWords);

/* customized word list from file */
$check = new Check('path.to/wordlist.php');

/* customized word list from array */
$badWords = array('bad', 'words'); // or load from db
$check = new Check($badWords);
```

Kudos
-----

[](#kudos)

Have to mention the following project as it gave me a good foundation for the regex and a list of swear words.

Thanks to @jackcsk for his contribution, adding the ability to use a plain array instead of a file for the list of profanities. Available in version &gt; v1.3.0.

### License

[](#license)

ProfanityFilter is open-sourced software licensed under the [MIT license](http://opensource.org/licenses/MIT)

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% 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 ~88 days

Recently: every ~68 days

Total

8

Last Release

3660d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/311251bff9b30184fcdaa12857975bcd0b7dcd9b409fe37e428bec2a19681f12?d=identicon)[developerdino](/maintainers/developerdino)

---

Top Contributors

[![developerdino](https://avatars.githubusercontent.com/u/747501?v=4)](https://github.com/developerdino "developerdino (67 commits)")[![jackcsk](https://avatars.githubusercontent.com/u/421731?v=4)](https://github.com/jackcsk "jackcsk (6 commits)")[![covienam](https://avatars.githubusercontent.com/u/10507992?v=4)](https://github.com/covienam "covienam (1 commits)")[![darrennolan](https://avatars.githubusercontent.com/u/1115755?v=4)](https://github.com/darrennolan "darrennolan (1 commits)")[![salvo1404](https://avatars.githubusercontent.com/u/5450842?v=4)](https://github.com/salvo1404 "salvo1404 (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mofodojodino-profanity-filter/health.svg)

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

PHPackages © 2026

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