PHP code example of voilab / htmlcleaner
1. Go to this page and download the library: Download voilab/htmlcleaner 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/ */
voilab / htmlcleaner example snippets
php
use \voilab\cleaner\HtmlCleaner;
$cleaner = new HtmlCleaner();
$raw_html = '...'; // take sample dataset above
echo $cleaner->clean($raw_html);
php
// create cleaner...
$cleaner->addAllowedTags(['p', 'strong']);
// call clean method
php
$cleaner
->addAllowedTags(['a'])
->addAllowedAttributes([
new \voilab\cleaner\attribute\Js('href')
]);