PHPackages                             vasart/naughty-words - 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. vasart/naughty-words

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

vasart/naughty-words
====================

List of naughty words

1.2.3(3y ago)0242proprietaryPHPPHP &gt;=7.0

Since Jul 15Pushed 3y agoCompare

[ Source](https://github.com/vasartam/php-naughty-words)[ Packagist](https://packagist.org/packages/vasart/naughty-words)[ Docs](https://github.com/vasartam/php-naughty-words)[ RSS](/packages/vasart-naughty-words/feed)WikiDiscussions master Synced 1mo ago

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

php-naughty-words
=================

[](#php-naughty-words)

A [List of Dirty, Naughty, Obscene, and Otherwise Bad Words](https://github.com/LDNOOBW/List-of-Dirty-Naughty-Obscene-and-Otherwise-Bad-Words) to use in PHP via [Composer](https://getcomposer.org/).

**Obvious warning**: These lists contain material that many will find offensive. (But that's the point!)

Before you start
----------------

[](#before-you-start)

If you think that implementing an automatic filter of bad words is a good idea, you should really check these articles first:

- [Obscenity Filters: Bad Idea, or Incredibly Intercoursing Bad Idea?](https://blog.codinghorror.com/obscenity-filters-bad-idea-or-incredibly-intercoursing-bad-idea/)
- [Scunthorpe problem](https://en.wikipedia.org/wiki/Scunthorpe_problem)

To sum it up, this library by no way should be used as a 100% way to get rid of obscene language in your application. People will always find out ways to bypass your filters. If you need to handle bad words, you need manual control. Tools like this one are meant to assist human moderation, not to replace it.

Use cases, where this library might be of use:

1. Requesting an approval from a moderator after user input validation when potentially bad words are found.
2. Refuse user input only when an exact match of a bad word is found.
    (This is easily bypassed when a bad word is given one more arbitrary letter, just so the exact match won't succeed.)

Installation
------------

[](#installation)

```
composer require vasart/naughty-words
```

Usage
-----

[](#usage)

Receiving a plain list of naughty words:

```
use VasArt\NaughtyWords\NaughtyWords;

$naughtyWordsEn = NaughtyWords::getForLanguage('en');
```

The string `'en'` inside `getForLanguage()` call here is the name of the file with bad words for the language of choice. See the list of available languages in [Languages](#Languages) section.

Using built-in validator:

```
use VasArt\NaughtyWords\Validator;

$text = 'some user input with potentially bad words';

$naughtyWordsValidator = new Validator( [ 'en', 'ru' ] );
$naughtyWords = $naughtyWordsValidator->findNaughtyWords( $text );

var_export($naughtyWords); // [ 'en' => 'word', 'ru' => false ]
```

For examining how does built-in validator work exactly you should check:

- test cases inside [ValidatorTest](test/ValidatorTest.php) class;
- regular expression that is built inside [WordsList](src/WordsList.php) class.

Languages
---------

[](#languages)

NameCode[Arabic](ar)ar[Chinese](zh)zh[Czech](cs)cs[Danish](da)da[Dutch](nl)nl[English](en)en[Esperanto](eo)eo[Filipino](fil)fil[Finnish](fi)fi[French](fr)fr[French (CA)](fr-CA-u-sd-caqc)fr-CA-u-sd-caqc[German](de)de[Hindi](hi)hi[Hungarian](hu)hu[Italian](it)it[Japanese](ja)ja[Kabyle](kab)kab[Klingon](tlh)tlh[Korean](ko)ko[Norwegian](no)no[Persian](fa)fa[Polish](pl)pl[Portuguese](pt)pt[Russian](ru)ru[Spanish](es)es[Swedish](sv)sv[Thai](th)th[Turkish](tr)trOther installation options
--------------------------

[](#other-installation-options)

If you need to use bad words inside an `npm` project, you can install the word list using the [naughty-words](https://github.com/LDNOOBW/naughty-words-js) package.

License
-------

[](#license)

The code, configuration and project description files are licensed under [GNU GPL 3.0](https://www.gnu.org/licenses/gpl-3.0.en.html), see [LICENSE](LICENSE).

The list of words is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/), see [LICENSE.words](LICENSE.words). © 2012–2020 Shutterstock, Inc.

More naughty words
------------------

[](#more-naughty-words)

- [expletives](https://github.com/alvations/expletives)
- [google-profanity-words](https://github.com/coffee-and-fun/google-profanity-words)
- [encycloDB / Dirty Words](https://github.com/turalus/encycloDB/tree/master/Dirty%20Words)

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity47

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.

###  Release Activity

Cadence

Every ~2 days

Total

7

Last Release

1386d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f976f4187da36820061f2ef113b8306d07f949f3ee4311313f7e4f3667f28df?d=identicon)[vasart](/maintainers/vasart)

---

Top Contributors

[![patch](https://avatars.githubusercontent.com/u/79241?v=4)](https://github.com/patch "patch (50 commits)")[![cesine](https://avatars.githubusercontent.com/u/196199?v=4)](https://github.com/cesine "cesine (43 commits)")[![vasartam](https://avatars.githubusercontent.com/u/15614336?v=4)](https://github.com/vasartam "vasartam (15 commits)")[![emmanuelrosa](https://avatars.githubusercontent.com/u/13485450?v=4)](https://github.com/emmanuelrosa "emmanuelrosa (8 commits)")[![dompie](https://avatars.githubusercontent.com/u/706491?v=4)](https://github.com/dompie "dompie (4 commits)")[![AshBardhan](https://avatars.githubusercontent.com/u/7280712?v=4)](https://github.com/AshBardhan "AshBardhan (3 commits)")[![leereilly](https://avatars.githubusercontent.com/u/121322?v=4)](https://github.com/leereilly "leereilly (3 commits)")[![hadavies](https://avatars.githubusercontent.com/u/100217543?v=4)](https://github.com/hadavies "hadavies (2 commits)")[![edent](https://avatars.githubusercontent.com/u/837136?v=4)](https://github.com/edent "edent (2 commits)")[![antonrufino](https://avatars.githubusercontent.com/u/6985235?v=4)](https://github.com/antonrufino "antonrufino (2 commits)")[![christianbundy](https://avatars.githubusercontent.com/u/537700?v=4)](https://github.com/christianbundy "christianbundy (2 commits)")[![Mte90](https://avatars.githubusercontent.com/u/403283?v=4)](https://github.com/Mte90 "Mte90 (2 commits)")[![wilmoore](https://avatars.githubusercontent.com/u/51953?v=4)](https://github.com/wilmoore "wilmoore (2 commits)")[![sloria](https://avatars.githubusercontent.com/u/2379650?v=4)](https://github.com/sloria "sloria (1 commits)")[![tomjn](https://avatars.githubusercontent.com/u/58855?v=4)](https://github.com/tomjn "tomjn (1 commits)")[![ValentinH](https://avatars.githubusercontent.com/u/2678610?v=4)](https://github.com/ValentinH "ValentinH (1 commits)")[![amtrivedi91](https://avatars.githubusercontent.com/u/11363990?v=4)](https://github.com/amtrivedi91 "amtrivedi91 (1 commits)")[![zvaehn](https://avatars.githubusercontent.com/u/5555821?v=4)](https://github.com/zvaehn "zvaehn (1 commits)")[![iMomen](https://avatars.githubusercontent.com/u/5030329?v=4)](https://github.com/iMomen "iMomen (1 commits)")[![lovasoa](https://avatars.githubusercontent.com/u/552629?v=4)](https://github.com/lovasoa "lovasoa (1 commits)")

---

Tags

wordsbadnaughtyobscene

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vasart-naughty-words/health.svg)

```
[![Health](https://phpackages.com/badges/vasart-naughty-words/health.svg)](https://phpackages.com/packages/vasart-naughty-words)
```

###  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.8M712](/packages/doctrine-inflector)[kwn/number-to-words

Multi language standalone PHP number to words converter. Fully tested, open for extensions and new languages.

4235.0M21](/packages/kwn-number-to-words)

PHPackages © 2026

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