2017 © Pedro Peláez
 

yii2-extension yii2-bad-word

Bad word filter for Yii2

image

idealia/yii2-bad-word

Bad word filter for Yii2

  • Monday, July 11, 2016
  • by pgrzelka
  • Repository
  • 6 Watchers
  • 0 Stars
  • 20 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 5 % Grown

The README.md

Bad word filter for Yii2

Bad word filter for Yii2, (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

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

or add, (*4)

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

to the require section of your composer.json file., (*5)

Apply migrations, (*6)

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

Add to config file, (*7)

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

Usage

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

In active record validator, (*8)

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

The Versions

11/07 2016

dev-master

9999999-dev

Bad word filter for Yii2

  Sources   Download

MIT

The Requires

 

extension yii2 bad word filter