rokorolov/yii2-purifier-behavior Purifier provides an ability to clean up HTML from any harmful code.

extensionbehaviorpurifier

yii2-purifier-behavior

Purifier provides an ability to clean up HTML from any harmful code.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist rokorolov/yii2-purifier-behavior "*"

or add

"rokorolov/yii2-purifier-behavior": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

Attach a behavior to model and configure.


use rokorolov\purifier\PurifierBehavior;

public function behaviors() 
{
    return [
        // ...
        'purifierBehavior' => [
            'class' => PurifierBehavior::className(),
            'attributes' => [
                self::EVENT_BEFORE_UPDATE => ['description'],
                self::EVENT_BEFORE_INSERT => ['description'],
            ],
            'textAttributes' => [
                self::EVENT_BEFORE_UPDATE => ['title', 'slug'],
                self::EVENT_BEFORE_INSERT => ['title', 'slug']
            ]
        ],
    ];
}

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



v1.0.0 is the latest of one release



BSD-3-Clause license
Stats
0 github stars & 1 github forks
4 downloads in the last day
168 downloads in the last 30 days
2436 total downloads