Skip to content

AlexanderWright/laravel-purifier

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 - http://htmlpurifier.org/

Installation

Composer

composer require alexusmai/laravel-purifier

Add service provider to config/app.php

Alexusmai\LaravelPurifier\LaravelPurifierServiceProvider::class,

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

About

HTMLPurifier - Laravel 5 package

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%