PHPackages                             snipe/banbuilder - 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. snipe/banbuilder

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

snipe/banbuilder
================

Library to easily handle profanity filtering in PHP projects.

2.3.1(2y ago)3371.5M—3.6%99[29 issues](https://github.com/snipe/banbuilder/issues)[7 PRs](https://github.com/snipe/banbuilder/pulls)3AGPL-3.0PHPPHP &gt;=5.6.0

Since Jan 15Pushed 10mo ago16 watchersCompare

[ Source](https://github.com/snipe/banbuilder)[ Packagist](https://packagist.org/packages/snipe/banbuilder)[ Docs](http://banbuilder.com)[ RSS](/packages/snipe-banbuilder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (15)Used By (3)

BanBuilder Composer Package
===========================

[](#banbuilder-composer-package)

[![Gitter](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/snipe/banbuilder?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://camo.githubusercontent.com/2360bfc43a7e94a2ec4b887a8f257f0cd57c60695dbb47c47b3be6794d430923/68747470733a2f2f7472617669732d63692e6f72672f736e6970652f62616e6275696c6465722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/snipe/banbuilder) [![Latest Stable Version](https://camo.githubusercontent.com/2e7c1f1635cbd0ac2fbe9e814701743e35e2cace76f42e09bae22afbcdec0a77/68747470733a2f2f706f7365722e707567782e6f72672f736e6970652f62616e6275696c6465722f762f737461626c652e737667)](https://packagist.org/packages/snipe/banbuilder) [![Total Downloads](https://camo.githubusercontent.com/63832b89f8f478f7fe5a5ad169032e48f6cfa0aa03fa4a557e49ac1ff8e39a73/68747470733a2f2f706f7365722e707567782e6f72672f736e6970652f62616e6275696c6465722f646f776e6c6f6164732e737667)](https://packagist.org/packages/snipe/banbuilder) [![Latest Unstable Version](https://camo.githubusercontent.com/3ab9a7d5a0b93a54165f2d23fc73e65a287c30185d6cc9aa75a598355f210847/68747470733a2f2f706f7365722e707567782e6f72672f736e6970652f62616e6275696c6465722f762f756e737461626c652e737667)](https://packagist.org/packages/snipe/banbuilder) [![License](https://camo.githubusercontent.com/6e543aebb6e01c66aefa8d5fd34eed5d4ce4e2a02e6bd2daabf56ad0a694b4a6/68747470733a2f2f706f7365722e707567782e6f72672f736e6970652f62616e6275696c6465722f6c6963656e73652e737667)](https://packagist.org/packages/snipe/banbuilder)

BanBuilder is a PHP package for profanity filtering. The PHP script uses regex to intelligently look for "leetspeak"-style numeric or symbol replacements.

Installing
----------

[](#installing)

To install BanBuilder, simply include it in your projects's `composer.json`.

```
"snipe/banbuilder": "dev-master",

```

There are no additional dependencies required for this package to work.

Usage
-----

[](#usage)

Please see the [official package website](https://banbuilder.com) for full usage details.

Summary
-------

[](#summary)

In a nutshell, this code takes an array of bad words and compares it to an array of common filter-evasion tactics. It then does a string replacement to insert regex parameters into your badwords array, and then evaluates your input string to that expanded banned word list.

So in your bad words array, you might have:

```
 [0] => 'ass'

```

The `preg_replace` functions replace all of the possible shenaningan letters with regex patterns (in lieu of adding the variants onto the end of the array), so the 'ass' in your array gets turned into this, right before the `preg_replace` checks for matches:

```
 [0] => /(a|a\.|a\-|4|@|Á|á|À|Â|à|Â|â|Ä|ä|Ã|ã|Å|å|α)(s|s\.|s\-|5|\$|§)(s|s\.|s\-|5|\$|§)/i

```

This means that a word can have none, one or any variety of leet replacements and it will still trip the trigger. Part of the leet filter includes stripping out letter-dash and letter-dots.

This means that the following all evaluate to the "bitch":

- B1tch
- bi7tch
- b.i.t.c.h.
- b-i-t-c-h
- b.1.t.c.h.
- ßitch
- and so on....

[![Flattr this git repo](https://camo.githubusercontent.com/7e3f46a36526479d701ef7f90a0f8c3ac2fbab3087446e2a9fceed75cd1ab802/687474703a2f2f6170692e666c617474722e636f6d2f627574746f6e2f666c617474722d62616467652d6c617267652e706e67)](https://flattr.com/submit/auto?user_id=snipe&url=https://github.com/snipe/banbuilder&title=banbuilder&language=PHP&tags=github&category=software)

Tests
-----

[](#tests)

To run the unit tests on this package, simply run `vendor/bin/phpunit` from the package directory.

---

License
-------

[](#license)

```
Copyright (C) 2013 Alison Gianotto - snipe@snipe.net

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program.  If not, see .

```

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity61

Solid adoption and visibility

Community35

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 68.5% 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 ~250 days

Recently: every ~756 days

Total

14

Last Release

894d ago

PHP version history (2 changes)2.0.0PHP &gt;=5.3.0

2.2.4PHP &gt;=5.6.0

### Community

Maintainers

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

---

Top Contributors

[![snipe](https://avatars.githubusercontent.com/u/197404?v=4)](https://github.com/snipe "snipe (100 commits)")[![BinaryKitten](https://avatars.githubusercontent.com/u/67553?v=4)](https://github.com/BinaryKitten "BinaryKitten (11 commits)")[![jegtnes](https://avatars.githubusercontent.com/u/1315463?v=4)](https://github.com/jegtnes "jegtnes (6 commits)")[![beryllium](https://avatars.githubusercontent.com/u/602491?v=4)](https://github.com/beryllium "beryllium (5 commits)")[![Jord-JD](https://avatars.githubusercontent.com/u/650645?v=4)](https://github.com/Jord-JD "Jord-JD (3 commits)")[![buzzedword](https://avatars.githubusercontent.com/u/334485?v=4)](https://github.com/buzzedword "buzzedword (2 commits)")[![TheInfernoX](https://avatars.githubusercontent.com/u/12787800?v=4)](https://github.com/TheInfernoX "TheInfernoX (2 commits)")[![thewilkybarkid](https://avatars.githubusercontent.com/u/1784740?v=4)](https://github.com/thewilkybarkid "thewilkybarkid (2 commits)")[![AD7six](https://avatars.githubusercontent.com/u/33387?v=4)](https://github.com/AD7six "AD7six (2 commits)")[![phaberest](https://avatars.githubusercontent.com/u/3464092?v=4)](https://github.com/phaberest "phaberest (1 commits)")[![rtxanson](https://avatars.githubusercontent.com/u/491085?v=4)](https://github.com/rtxanson "rtxanson (1 commits)")[![ryoshu](https://avatars.githubusercontent.com/u/176377?v=4)](https://github.com/ryoshu "ryoshu (1 commits)")[![shinracoder](https://avatars.githubusercontent.com/u/4995641?v=4)](https://github.com/shinracoder "shinracoder (1 commits)")[![uberbrady](https://avatars.githubusercontent.com/u/36335?v=4)](https://github.com/uberbrady "uberbrady (1 commits)")[![bviolier](https://avatars.githubusercontent.com/u/1247610?v=4)](https://github.com/bviolier "bviolier (1 commits)")[![dfridrich](https://avatars.githubusercontent.com/u/3758421?v=4)](https://github.com/dfridrich "dfridrich (1 commits)")[![dokinoki](https://avatars.githubusercontent.com/u/5940030?v=4)](https://github.com/dokinoki "dokinoki (1 commits)")[![emirozer](https://avatars.githubusercontent.com/u/5015104?v=4)](https://github.com/emirozer "emirozer (1 commits)")[![geo-at-github](https://avatars.githubusercontent.com/u/4470794?v=4)](https://github.com/geo-at-github "geo-at-github (1 commits)")[![mattclegg](https://avatars.githubusercontent.com/u/303487?v=4)](https://github.com/mattclegg "mattclegg (1 commits)")

---

Tags

languagestringsfilterprofanityswear

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/snipe-banbuilder/health.svg)

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

###  Alternatives

[doctrine/inflector

PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.

11.4k855.8M711](/packages/doctrine-inflector)[phpoption/phpoption

Option Type for PHP

2.7k541.2M159](/packages/phpoption-phpoption)[diego-ninja/sentinel

A content moderation and sentiment analysis library for Laravel 10+

384.3k](/packages/diego-ninja-sentinel)[patrickschur/language-detection

A language detection library for PHP. Detects the language from a given text string.

8513.2M18](/packages/patrickschur-language-detection)[wapmorgan/morphos

A morphological solution for Russian and English language written completely in PHP. Provides classes to inflect personal names, geographical names, decline and pluralize nouns, generate cardinal and ordinal numerals, spell out money amounts and time.

8351.3M7](/packages/wapmorgan-morphos)[coderello/laravel-nova-lang

Language support for Laravel Nova.

4251.2M2](/packages/coderello-laravel-nova-lang)

PHPackages © 2026

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