PHPackages                             jojoee/leo-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. [Search &amp; Filtering](/categories/search)
4. /
5. jojoee/leo-profanity

ActiveLibrary[Search &amp; Filtering](/categories/search)

jojoee/leo-profanity
====================

Profanity filter, based on Shutterstock dictionary

v1.2.2(9y ago)57.1k↓50%2[1 issues](https://github.com/jojoee/leo-profanity-php/issues)MITPHPPHP ~5.6|~7.0

Since Mar 13Pushed 9y ago2 watchersCompare

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

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

leo-profanity-php
=================

[](#leo-profanity-php)

[![Latest Version on Packagist](https://camo.githubusercontent.com/cee3f2f2f6210da3b497fd97a576dd2eb8570ab49990fb92e90339bf95ee2793/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f6a6f65652f6c656f2d70726f66616e6974792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jojoee/leo-profanity)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/b14ea816cdef78bae65cfe0cc9e36cfbed442bfc1df8441ba8087519ee90061e/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6f6a6f65652f6c656f2d70726f66616e6974792d7068702f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/jojoee/leo-profanity-php)

Profanity filter, based on Shutterstock dictionary

Install
-------

[](#install)

Via Composer

```
$ composer require jojoee/leo-profanity
```

```
use Jojoee\Library\LeoProfanity as LeoProfanity;

$filter = new LeoProfanity();
$filter->check('I have BoOb');
```

Usage
-----

[](#usage)

### $filter-&gt;getList()

[](#filter-getlist)

```
// return all profanity words (string[])
$filter->getList();
```

### $filter-&gt;check(string)

[](#filter-checkstring)

Check out mor example on `clean` method

```
// output: true
$filter->clean('I have boob');
```

### $filter-&gt;clean(string, \[replaceKey=\*\])

[](#filter-cleanstring-replacekey)

```
// no bad word
// output: I have 2 eyes
$filter->clean('I have 2 eyes');

// normal case
// output: I have ****, etc.
$filter->clean('I have boob, etc.');

// case sensitive
// output: I have ****
$filter->clean('I have BoOb');

// separated by comma and dot
// output: I have ****.
$filter->clean('I have BoOb.');

// multi occurrence
// output: I have ****,****, ***, and etc.
$filter->clean('I have boob,boob, ass, and etc.');

// should not detect unspaced-word
// output: Buy classic watches online
$filter->clean('Buy classic watches online');

// clean with custom replacement-character
// output: I have ++++
$filter->clean('I have boob', '+');
```

### $filter-&gt;add(string|string\[\])

[](#filter-addstringstring)

```
// add word
$filter->add('b00b');

// add word's array
// check duplication automatically
$filter->add(['b00b', 'b@@b']);
```

### $filter-&gt;remove(string|string\[\])

[](#filter-removestringstring)

```
// remove word
$filter->remove('b00b');

// remove word's array
$filter->remove(['b00b', 'b@@b']);
```

### $filter-&gt;reset()

[](#filter-reset)

Reset word list by using default dictionary (also remove word that manually add)

### $filter-&gt;clearList()

[](#filter-clearlist)

Clear all profanity words

Note
----

[](#note)

- [Filter algorithm from `jojoee/leo-profanity`](https://github.com/jojoee/leo-profanity#algorithm)
- Testing (using `composer test`)
- [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) (tested by `composer check-style` and fix it with `composer fix-style`.)
- Security, if you discover any security related issues, please email  instead of using the issue tracker.
- Follow [SemVer v2.0.0](http://semver.org/)
- Coherent history (each individual commit is meaningful), if not please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages).

TODO
----

[](#todo)

- Unit test
- Test coverage
- PHP CodeSniffer
- Support PHP version 5.6, 7.0, hhvm

Other languages
---------------

[](#other-languages)

- Javascript on [npmjs.com/package/leo-profanity](https://www.npmjs.com/package/leo-profanity)
- PHP on [packagist.org/packages/jojoee/leo-profanity](https://packagist.org/packages/jojoee/leo-profanity)
- Python on [PyPI](https://pypi.python.org/pypi)
- Java on [Maven](https://maven.apache.org/)
- Wordpress on [wordpress.org](https://wordpress.org/)

Contribute
----------

[](#contribute)

Please run `composer check` and fix before commit

Reference
---------

[](#reference)

- Skeleton template: [thephpleague/skeleton](https://github.com/thephpleague/skeleton), [koriym/Koriym.PhpSkeleton](https://github.com/koriym/Koriym.PhpSkeleton), [petk/php-skeleton](https://github.com/petk/php-skeleton)

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance16

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity61

Established project with proven stability

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

Total

4

Last Release

3328d ago

Major Versions

0.0.3 → v1.2.22017-03-31

### Community

Maintainers

![](https://www.gravatar.com/avatar/c9f6a77b18f8bddaba0a17d71576408670a0521486dd338fdd740c726900e0fb?d=identicon)[jojoee](/maintainers/jojoee)

---

Top Contributors

[![jojoee](https://avatars.githubusercontent.com/u/11144228?v=4)](https://github.com/jojoee "jojoee (34 commits)")

---

Tags

badcursedirtyobsceneprofanityswearstringwordwordsfilterprofanitylistcleandirtyswearbadcurseobscene

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jojoee-leo-profanity/health.svg)

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

###  Alternatives

[snipe/banbuilder

Library to easily handle profanity filtering in PHP projects.

3371.5M3](/packages/snipe-banbuilder)[htmlawed/htmlawed

Official htmLawed PHP library for HTML filtering

401.1M9](/packages/htmlawed-htmlawed)[vria/nodiacritic

Tiny helper function that removes all diacritical signs from characters

113.1M13](/packages/vria-nodiacritic)[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)
