PHPackages                             ph-7/notallowed - 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. ph-7/notallowed

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

ph-7/notallowed
===============

Filter profane words, usernames, spam/temporary emails, etc.

2.1.0(2y ago)92284MITPHPPHP &gt;=8.1

Since Jul 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/pH-7/NotAllowed)[ Packagist](https://packagist.org/packages/ph-7/notallowed)[ Docs](https://ph7.me)[ GitHub Sponsors](https://github.com/pH-7)[ Fund](https://ko-fi.com/phenry)[ RSS](/packages/ph-7-notallowed/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

🚫 Not Allowed 🚫
===============

[](#-not-allowed-)

**NotAllowed** is a simple, lightweight PHP 8.1 library that helps you censor words, profane words, blacklisted IPs, forbidden usernames, banned bank card numbers, etc.

You can easily add new specific keywords (such as IPs, usernames, bank accounts, words, etc.) to be banned in `~/src/banned-data/*` folder.

🛠 Server Requirement
--------------------

[](#-server-requirement)

- [PHP 8.1](https://www.php.net/releases/8.1/en.php) or higher.

📓 Installation (with Composer)
------------------------------

[](#-installation-with-composer)

```
composer require ph-7/notallowed
```

🎮 Usage
-------

[](#-usage)

Simple example of what you can do with NotAllowed 🙂

```
use PH7\NotAllowed\Ban;

if (Ban::isUsername('admin')) {
    echo '"admin" is not allowed as username.';
}

if (Ban::isEmail('james@spamhole.com')) {
    echo '"@spamhole.com" domain is considered a spam email host.';
}

if (Ban::isWord('He is an asshole')) {
    echo 'Please watch your mouth :-)';
}

if (Ban::isIp('1.170.36.229')) {
    echo 'This IP address is blacklisted';
}

$userInput = 'admin';
if (Ban::isUsername($userInput, ['root', 'sudo', 'admin'])) {
    echo "$userInput is not allowed";
}

// Check if $userInput contains a banned word OR a banned username
if (Ban::isAny($userInput, email: false, word: true, username: true)) {
    echo "$userInput is not allowed";
}
```

### Extending Banned Phrases

[](#extending-banned-phrases)

You can supply your own values to be merged with the out-of-box banned data in 2 ways:

1. `Ban::merge(string $scope, string | array $value)`
2. `Ban::mergeFile(string $scope, string $path)`

`$scope` refers to the category of data. Possible values are currently:

- usernames
- words
- ips
- emails
- bank\_accounts

Example```
Ban::merge('usernames', ['pooter', 'hitler', '690']);
Ban::merge('words', ['cuck', 'bomb']);
Ban::mergeFile('emails', './my_banned_emails.txt');
```

Now simply validate per normal conventions.

🚀 Author
--------

[](#-author)

**[Pierre-Henry Soria](https://pierrehenry.be)**, a highly passionate, zen &amp; cool software engineer 😊

[![@phenrysay](https://camo.githubusercontent.com/13407d82ada56ba32915da737a691b0c2494ccc1cbf156b9f10eb0353488891a/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f75726c2f68747470732f736869656c64732e696f2e7376673f7374796c653d736f6369616c)](https://twitter.com/phenrysay)

[![Pierre-Henry Soria](https://avatars0.githubusercontent.com/u/1325411?s=220)](https://pierrehenry.be "Pierre-Henry - Software Developer Website :-)")

### 👩🏻‍💻 Helpers

[](#‍-helpers)

**[soulshined](https://github.com/soulshined)** - just a coder

🧐 Used By...
------------

[](#-used-by)

**[pH7Builder](https://ph7cms.com)**, a social dating webapp builder. Used here: [https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/\_protected/framework/Security/Ban/Ban.class.php](https://github.com/pH7Software/pH7-Social-Dating-CMS/blob/master/_protected/framework/Security/Ban/Ban.class.php).

⚖️ License
----------

[](#️-license)

Generously distributed under [MIT License](https://opensource.org/licenses/MIT)! 🎈

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance30

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 87.8% 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 ~285 days

Recently: every ~356 days

Total

6

Last Release

1070d ago

Major Versions

1.3.0 → 2.0.02023-01-15

PHP version history (2 changes)1.0.0PHP &gt;=7.2.0

2.0.0PHP &gt;=8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/b6d95da236687f1dca4f7d70d60037c70ef217120ea195df23a39a412ba594e0?d=identicon)[ph-7](/maintainers/ph-7)

---

Top Contributors

[![pH-7](https://avatars.githubusercontent.com/u/1325411?v=4)](https://github.com/pH-7 "pH-7 (79 commits)")[![soulshined](https://avatars.githubusercontent.com/u/11242654?v=4)](https://github.com/soulshined "soulshined (11 commits)")

---

Tags

banban-wordsbannedblacklistcensorcensored-wordscheck-wordsfilter-wordsphp72profaneprofane-wordssecurityspamsecuritywordfilterspamemailstemporary emailbanprofanebannednot allowedprofane wordsfilter wordsscam

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ph-7-notallowed/health.svg)

```
[![Health](https://phpackages.com/badges/ph-7-notallowed/health.svg)](https://phpackages.com/packages/ph-7-notallowed)
```

###  Alternatives

[clue/stream-filter

A simple and modern approach to stream filtering in PHP

1.7k261.7M7](/packages/clue-stream-filter)[laminas/laminas-filter

Programmatically filter and normalize data and files

9528.0M150](/packages/laminas-laminas-filter)[ircmaxell/filterus

A library for filtering variables in PHP

44813.4k5](/packages/ircmaxell-filterus)[soosyze/kses

An HTML/XHTML filter written in PHP. Checks on attribute values. Can be used to avoid Cross-Site Scripting (XSS), Buffer Overflows and Denial of Service attacks, among other things.

1258.5k1](/packages/soosyze-kses)

PHPackages © 2026

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