alexusmai/laravel-purifier
HTMLPurifier - Laravel 5 package
HTML Purifier is a standards-compliant HTML filter library written in PHP.
About HTML Purifier - http://htmlpurifier.org/
Installation
Composer
composer require alexusmai/laravel-purifier
If you have Laravel 5.4 or earlier version, then add service provider to config/app.php and
Alexusmai\LaravelPurifier\LaravelPurifierServiceProvider::class,
add alias.
'Purifier' => Alexusmai\LaravelPurifier\Facades\PurifierFacade::class,
Publish config file (purifier.php)
php artisan vendor:publish --provider="Alexusmai\LaravelPurifier\LaravelPurifierServiceProvider"
Usage
Use default settings (config/purifier.php - default)
// string
Purifier::clean($text);
// array
Purifier::clean(['text1', 'text2', 'text3']);
// or use helper function
purifier($text);
Or you can create your own settings in configuration file (config/purifier.php)
Purifier::clean($text, 'my-settings-name');
purifier($text, 'my-settings-name');
Or you can use dynamic configuration
Purifier::clean($text, ['HTML.Allowed' => 'div,br,span']);
purifier($text, ['HTML.Allowed' => 'div,br,span']);
Related Packages
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| 1.0 | >=5.6.4 | 5.1.*| | MIT | |
| 0.9 | >=5.6.4 | 5.1.*| | MIT | |
| 0.8 | >=5.6.4 | 5.1.*| | MIT | |
| 0.7 | >=5.6.4 | 5.1.*| | MIT | |
| 0.6 | >=5.6.4 | 5.1.*| | MIT | |
| 0.5 | >=5.6.4 | 5.1.*| | MIT | |
| 0.4 | >=5.6.4 | 5.1.*| | MIT | |
| 0.3 | >=5.6.4 | 5.1.*| | MIT | |
| 0.2 | >=5.6.4 | 5.1.*| | MIT | |
| 0.1 | >=5.6.4 | 5.1.*| | MIT |