1. Go to this page and download the library: Download tokimikichika/htmlsanitizer 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/ */
tokimikichika / htmlsanitizer example snippets
use Tokimikichika\HtmlSanitizer\HtmlSanitizer;
use Tokimikichika\HtmlSanitizer\Service\HtmlCleanerService;
use Tokimikichika\HtmlSanitizer\Service\TextNormalizerService;
$sanitizer = new HtmlSanitizer(
new HtmlCleanerService(),
new TextNormalizerService()
);
$cleanText = $sanitizer->sanitizeText('<p>Hello <strong>world</strong>!</p>');
// Результат: "Hello world!"
use Tokimikichika\HtmlSanitizer\HtmlSanitizer;
use Tokimikichika\HtmlSanitizer\Service\HtmlCleanerService;
use Tokimikichika\HtmlSanitizer\Service\TextNormalizerService;
$sanitizer = new HtmlSanitizer(
new HtmlCleanerService(),
new TextNormalizerService()
);
$cleanText = $sanitizer->sanitizeText($html);
use Tokimikichika\HtmlSanitizer\Service\HtmlCleanerService;
use Tokimikichika\HtmlSanitizer\Service\TextNormalizerService;
$cleaner = new HtmlCleanerService();
$normalizer = new TextNormalizerService();
$html = $cleaner->removeScriptAndStyleTags($html);
$html = $cleaner->removeComments($html);
$html = $cleaner->decodeHtmlEntities($html);
$text = $cleaner->stripHtmlTags($html);
$text = $normalizer->normalizeWhitespace($text);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.