PHPackages                             arif-rh/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. arif-rh/profanity-filter

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

arif-rh/profanity-filter
========================

Filter bad words and profanities.

v1.0.1(5y ago)011.1kMITPHPPHP &gt;=7.2

Since Oct 4Pushed 5y ago1 watchersCompare

[ Source](https://github.com/arif-rh/profanity-filter)[ Packagist](https://packagist.org/packages/arif-rh/profanity-filter)[ Docs](https://github.com/arif-rh/profanity-filter)[ RSS](/packages/arif-rh-profanity-filter/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (2)Versions (3)Used By (0)

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

[](#profanity-filter)

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

Note:

- This package is extended version from [DeveloperDino\\ProfanityFilter](https://github.com/developerdino/ProfanityFilter), with some extra new features.

NEW FEATURE
-----------

[](#new-feature)

---

- `cleanWords` : obfuscate only the bad words, original package will obfuscate all sentence [see this issue](https://github.com/developerdino/ProfanityFilter/issues/20). ```
    // assume that 'badword' is a bad word
    $words = 'This is a badword';

    echo $check->cleanWords($words);
    // output -> This is a *******

    echo $check->cleanWords($words, '+');
    // output -> This is a +++++++

    ```
- `getBadWordsfound` -&gt; get bad word string from check ```
    // assume that 'badword' is a bad word
    $words = 'This is a badword';

    $check->hasProfanity($words);
    echo $check->getBadWordsFound();
    // output -> badword

    ```
- Whitelists : Set some whitelist word to fix [false positive issue](https://github.com/developerdino/ProfanityFilter/issues/21) filter ```
    // Set whitelist when initialize the class
    $filter = new Check($profinities, $whitelist);

    See `NotProfaneTest` to see more example of whitelist test

    ```

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);
```

### License

[](#license)

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

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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 ~0 days

Total

2

Last Release

2052d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b5e5b51452ac209ba31bade4dcabea32ebb599e0a49c778524e780aeb2b9bf0f?d=identicon)[arif-rh](/maintainers/arif-rh)

---

Top Contributors

[![arif-rh](https://avatars.githubusercontent.com/u/2386359?v=4)](https://github.com/arif-rh "arif-rh (6 commits)")

---

Tags

profanityProfanity Filterbad word cleanerprofanity check

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[snipe/banbuilder

Library to easily handle profanity filtering in PHP projects.

3371.5M3](/packages/snipe-banbuilder)[waad/laravel-profanity-filter

Laravel Profanity Filter - Powerful PHP package for detecting, filtering, and masking profanity in multiple languages. Supports leet speak, custom word lists, case sensitivity, and seamless Laravel integration.

202.9k](/packages/waad-laravel-profanity-filter)[swearjar/swearjar

Profanity detection lib

14158.0k1](/packages/swearjar-swearjar)[diego-ninja/sentinel

A content moderation and sentiment analysis library for Laravel 10+

384.3k](/packages/diego-ninja-sentinel)

PHPackages © 2026

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