HTMLPurifier - Laravel 5 package
Branch: master
Clone or download
Latest commit 1403725 Aug 23, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
config init Feb 7, 2017
src fix settings error Aug 1, 2018
.gitignore init Feb 7, 2017 init Feb 7, 2017 upd purifier Sep 20, 2017
composer.json laravel 5.7 Aug 23, 2018

HTMLPurifier - Laravel 5 package

Latest Stable Version Total Downloads Latest Unstable Version License

HTML Purifier is a standards-compliant HTML filter library written in PHP.

About HTML Purifier -



composer require alexusmai/laravel-purifier

If you have Laravel 5.4 or earlier version, then add service provider to config/app.php and


add alias.

'Purifier' => Alexusmai\LaravelPurifier\Facades\PurifierFacade::class,

Publish config file (purifier.php)

php artisan vendor:publish --provider="Alexusmai\LaravelPurifier\LaravelPurifierServiceProvider"


Use default settings (config/purifier.php - default)

// string

// array
Purifier::clean(['text1', 'text2', 'text3']);

// or use helper function

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']);