symfony/html-sanitizer
Object-oriented HTML sanitizer for PHP/Symfony. Safely cleans untrusted HTML for DOM insertion with configurable allow/block/drop rules, attribute policies, forced values, and URL controls (HTTPS and scheme/host allowlists). Removes scripts and unsafe behaviors.
Symfony’s HtmlSanitizer component provides an object-oriented API to sanitize untrusted HTML before inserting it into the DOM. It helps prevent common XSS vectors by allowing you to define a clear policy for which elements, attributes, and URL schemes are permitted.
Build a reusable HtmlSanitizerConfig that can allow, block, or drop specific tags and attributes, enforce safer defaults, and normalize links for consistent output.
How can I help you explore Laravel packages today?