tgalopin/html-sanitizer 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tgalopin/html-sanitizer

最新稳定版本:1.5.0

Composer 安装命令:

composer require tgalopin/html-sanitizer

包简介

Sanitize untrustworthy HTML user input

README 文档

README

This library is deprecated as it was merged into Symfony as the HtmlSanitizer component in Symfony 6.1: https://symfony.com/doc/current/html_sanitizer.html

Build Status Packagist Version Software license

SymfonyInsight

html-sanitizer is a library aiming at handling, cleaning and sanitizing HTML sent by external users (who you cannot trust), allowing you to store it and display it safely. It has sensible defaults to provide a great developer experience while still being entirely configurable.

Internally, the sanitizer has a deep understanding of HTML: it parses the input and create a tree of DOMNode objects, which it uses to keep only the safe elements from the content. By using this technique, it is safe (it works with a strict whitelist), fast and easily extensible.

It also provides useful features such as the possibility to transform images or iframes URLs to HTTPS.

Symfony integration

This library is also available as a Symfony bundle.

Documentation

  1. Getting started
  2. Creating an extension to allow custom tags
  3. Configuration reference
  4. Comparison with HTMLPurifier

Security Issues

If you discover a security vulnerability within the sanitizer, please follow our disclosure procedure.

Backward Compatibility promise

This library follows the same Backward Compatibility promise as the Symfony framework: https://symfony.com/doc/current/contributing/code/bc.html

Note: many classes in this library are either marked @final or @internal. @internal classes are excluded from any Backward Compatiblity promise (you should not use them in your code) whereas @final classes can be used but should not be extended (use composition instead).

Thanks

Many thanks to:

统计信息

  • 总下载量: 5.3M
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 366
  • 点击次数: 1
  • 依赖项目数: 9
  • 推荐数: 0

GitHub 信息

  • Stars: 365
  • Watchers: 17
  • Forks: 41
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04