Registry / security / symfony-html-sanitizer

symfony-html-sanitizer

JSON →
library8.1.0phppackagistunverified

Provides an object-oriented API to sanitize untrusted HTML input for safe insertion into a document's DOM.

composer require symfony/html-sanitizer
INSTALL
IMPORT
SIG · SYMFONY-HTML-SANIT
S
symfony-html-sanitizer
securityphpv8.1.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

HtmlSanitizer
use Symfony\Component\HtmlSanitizer\HtmlSanitizer;

Sanitize untrusted HTML to prevent XSS attacks.

use Symfony\Component\HtmlSanitizer\HtmlSanitizer; $sanitizer = new HtmlSanitizer(); $cleanHtml = $sanitizer->sanitize('<script>alert("xss")</script><p>Safe</p>'); echo $cleanHtml;
Debug
Known issues
breakingRequires PHP 8.1+
fix
Upgrade to PHP 8.1 or later.
affects: <8.1.0
Upgrade
Version history
8.1.0latest on Packagist
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
Resources
symfony-html-sanitizer — pip install symfony-html-sanitizer · libregistry