Download the PHP package eugenecooper/purify without Composer
On this page you can find all versions of the php package eugenecooper/purify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download eugenecooper/purify
More information about eugenecooper/purify
Files in eugenecooper/purify
Informations about the package purify
Purify
Description
Purify is an HTML Purifier helper for Laravel 5. It utilizes the fantastic package HTMLPurifier by ezyang. All credit for purification goes to him.
Installation
To install Purify, insert the following require in your composer.json
file:
"stevebauman/purify": "1.1.*"
Now run a composer update
on your project source.
Once that's finished, insert the service provider in your app/config/app.php
(or config/app.php
for Laravel 5) configuration file:
'Stevebauman\Purify\PurifyServiceProvider'
You can also use the facade if you wish:
'Purify' => 'Stevebauman\Purify\Facades\Purify'
Usage
Cleaning a String
To clean a users input, simply use the clean method:
Cleaning an Array
Need to purify an array of user input? Just pass in an array:
Dynamic Configuration
Need to add or modify rules for a single input? Pass in a configuration array into the second parameter:
Note: Configuration passed into the second parameter is merged with the current configuration and will overwrite array keys you supply. This allows you to add settings on the fly. Simply pass
false
into the third parameter if you do not want the configuration merged.
Replacing the HTML Purifier instance
Need to replace the HTML Purifier instance with your own? Call the setPurifier()
method:
Replacing the HTML Purifier Configuration instance
Need to replace the HTML Purifier Configuration instance with your own? Call the setPurifierConfig()
method:
Configuration
Inside the configuration file, the entire settings array is passed directly to the HTML Purifier configuration, so feel free to customize it however you wish. For the configuration documentation, please visit the HTML Purifier Website: