PHPackages                             idealia/yii2-bad-word - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. idealia/yii2-bad-word

ActiveYii2-extension[Validation &amp; Sanitization](/categories/validation)

idealia/yii2-bad-word
=====================

Bad word filter for Yii2

0124PHP

Since Jul 11Pushed 9y ago6 watchersCompare

[ Source](https://github.com/Idealia/yii2-bad-word)[ Packagist](https://packagist.org/packages/idealia/yii2-bad-word)[ RSS](/packages/idealia-yii2-bad-word/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependenciesVersions (1)Used By (0)

Bad word filter for Yii2
========================

[](#bad-word-filter-for-yii2)

Bad word filter for Yii2

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

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
php composer.phar require --prefer-dist idealia/yii2-bad-word "*"

```

or add

```
"idealia/yii2-bad-word": "*"

```

to the require section of your `composer.json` file.

Apply migrations

```
php yii migrate --migrationPath=@vendor/idealia/yii2-bad-word/migrations

```

Add to config file

```
'components' => [
        'badword' => [
            'class' => \idealia\badword\BadWord::class,
            // 'obfuscation' => true,
            'provider' => [
                'class' => \idealia\badword\BadWordDbProvider::class
            ]
        ],
]

```

Usage
-----

[](#usage)

```
$foo = Yii::$app->badword->filter('your text with bad words to replace by ***');

```

In active record validator

```
public function rules()
{
   return [
        ['title',  BadWordFilter::class],
   ]
}

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b4c32d3e8496b6d73037dfa3faf736602d147c92d0403cf51593e095e313dda?d=identicon)[pgrzelka](/maintainers/pgrzelka)

---

Top Contributors

[![piotr-grzelka](https://avatars.githubusercontent.com/u/1458551?v=4)](https://github.com/piotr-grzelka "piotr-grzelka (5 commits)")

### Embed Badge

![Health badge](/badges/idealia-yii2-bad-word/health.svg)

```
[![Health](https://phpackages.com/badges/idealia-yii2-bad-word/health.svg)](https://phpackages.com/packages/idealia-yii2-bad-word)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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