Package Data | |
---|---|
Maintainer Username: | alexusmai |
Maintainer Contact: | alexusmai@gmail.com (Alex) |
Package Create Date: | 2017-02-07 |
Package Last Update: | 2020-09-09 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2024-12-19 03:10:26 |
Package Statistics | |
---|---|
Total Downloads: | 4,373 |
Monthly Downloads: | 1 |
Daily Downloads: | 0 |
Total Stars: | 1 |
Total Watchers: | 1 |
Total Forks: | 2 |
Total Open Issues: | 0 |
HTML Purifier is a standards-compliant HTML filter library written in PHP.
About HTML Purifier - http://htmlpurifier.org/
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"
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']);