1. Go to this page and download the library: Download mews/purifier library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
clean('This is my H1 title', 'titles');
clean('This is my H1 title', array('Attr.EnableID' => true));
Purifier::clean('This is my H1 title', 'titles');
Purifier::clean('This is my H1 title', array('Attr.EnableID' => true));
Purifier::clean('This is my H1 title', 'titles', function (HTMLPurifier_Config $config) {
$uri = $config->getDefinition('URI');
$uri->addFilter(new HTMLPurifier_URIFilter_NameOfFilter(), $config);
});
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Mews\Purifier\Casts\CleanHtml;
use Mews\Purifier\Casts\CleanHtmlInput;
use Mews\Purifier\Casts\CleanHtmlOutput;
class Monster extends Model
{
protected $casts = [
'bio' => CleanHtml::class, // cleans both when getting and setting the value
'description' => CleanHtmlInput::class, // cleans when setting the value
'history' => CleanHtmlOutput::class, // cleans when getting the value
];
}