PHPackages                             linkthrow/profanityfilter - 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. linkthrow/profanityfilter

ActiveLibrary

linkthrow/profanityfilter
=========================

Profanity filter package would help you censor some of the bad words users put in your posts and/or comments.

0111PHP

Since Feb 29Pushed 10y ago1 watchersCompare

[ Source](https://github.com/linkthrow/ProfanityFilter)[ Packagist](https://packagist.org/packages/linkthrow/profanityfilter)[ RSS](/packages/linkthrow-profanityfilter/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

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

[](#profanity-filter)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d92047ea4d9e48a04389aecd074717addbd5dbfacc8340864070e886a17a270d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f4c696e6b5468726f772f70726f66616e69747966696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/LinkThrow/profanityfilter)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/211ce3438865d87c2b009aecc29876cec84fac2400bd43b1253ab28f7eea87d3/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f4c696e6b5468726f772f50726f66616e69747946696c7465722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/LinkThrow/ProfanityFilter)[![Quality Score](https://camo.githubusercontent.com/3316283af6db17137c32e85fb7f86aa3c6b01e1e505f88c75d2b0597e689ad7f/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f4c696e6b5468726f772f50726f66616e69747946696c7465722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/LinkThrow/ProfanityFilter)[![Total Downloads](https://camo.githubusercontent.com/c29ef7511de4dea0d27e24ed675f3292a4ba2c561b4644dfdd9ecb5b057f5f2d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f4c696e6b5468726f772f70726f66616e69747966696c7465722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/LinkThrow/profanityfilter)

Profanity Filter takes strings as input and removes any bad curse words that the string might have. It check the string for specific blacklist which must match as a sperate word to be considered as a curse word. If a curse word is found, then it will replace the curse word with a censor character the user chooses (default is \*).

Default curse words from Shuttershock list of banned words

This package is intended to used with Laravel. Tested and working with laravel 5.1.

This code is based on [Fastwebmedia/Profanity-Filter](https://github.com/fastwebmedia/Profanity-Filter). A major part of it is taken from there and I added the things that I thought it required.

Install
-------

[](#install)

Via Composer

```
$ composer require LinkThrow/profanityfilter
```

\###Laravel Add `LinkThrow\ProfanityFilter\ProfanityFilterServiceProvider::class` to your providers array.

If you wish to use the Facade then add `'Profanity' => LinkThrow\ProfanityFilter\Facades\Profanity::class`

The package will automatically use the config file containing the list of banned words.

Usage
-----

[](#usage)

```
$swear_word = ['dog'];
$blacklist  = ['puppy'];
$replace    = ['a' => '(a|a\.|a\-|4|@|Á|á|À|Â|à|Â|â|Ä|ä|Ã|ã|Å|å|α|Δ|Λ|λ)'];

$profanity_filter = new LinkThrow\ProfanityFilter($swear_words, $blacklist, $replace);
echo $profanity_filter->clean('Dog, puppy badpuppy baddog!', '$');
```

The above code would return:

```
array(
    'old_string' => 'Dog, puppy badpuppy baddog!',
    'new_string' => '$$$, $$$$$ badpuppy bad$$$!',
    'clean'      => false
);
```

Change log
----------

[](#change-log)

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

Testing
-------

[](#testing)

```
$ phpspec run
```

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

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

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

Credits
-------

[](#credits)

- [LinkThrow Shakya](https://github.com/LinkThrow)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e398ed2a3aef70c486ed7cf01f5571eced0a795b6ce000f7ed18e58aea10111?d=identicon)[linkthrow](/maintainers/linkthrow)

---

Top Contributors

[![hchoudhrydw](https://avatars.githubusercontent.com/u/11502212?v=4)](https://github.com/hchoudhrydw "hchoudhrydw (5 commits)")[![linkthrow](https://avatars.githubusercontent.com/u/16664738?v=4)](https://github.com/linkthrow "linkthrow (4 commits)")[![sworup](https://avatars.githubusercontent.com/u/683452?v=4)](https://github.com/sworup "sworup (4 commits)")

### Embed Badge

![Health badge](/badges/linkthrow-profanityfilter/health.svg)

```
[![Health](https://phpackages.com/badges/linkthrow-profanityfilter/health.svg)](https://phpackages.com/packages/linkthrow-profanityfilter)
```

PHPackages © 2026

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