定制 eyupcanakman/htmlawed 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

eyupcanakman/htmlawed

最新稳定版本:v3.0.0

Composer 安装命令:

composer require eyupcanakman/htmlawed

包简介

PHP 8.4+ compatible fork of vanilla/htmlawed — a composer wrapper for the htmLawed library to purify & filter HTML.

README 文档

README

PHP 8.4+ compatible fork of vanilla/htmlawed.

A composer wrapper for the htmLawed library to purify & filter HTML.

Why this fork?

The original vanilla/htmlawed (v2.2.15, Sep 2023) is unmaintained and triggers PHP 8.4 deprecation notices due to implicit nullable parameters. These deprecation notices produce output that breaks HTTP headers in API responses.

Changes from vanilla/htmlawed v2.2.15

  • Added explicit nullable type hints to Htmlawed::filter() (?array $config, string|array|null $spec)
  • Added parameter and return types to Htmlawed::filter() and Htmlawed::filterRSS()
  • Bumped minimum PHP requirement to 8.1
  • No changes to the htmLawed core library (htmLawed.php)

Installation

Requires PHP 8.1+.

composer require eyupcanakman/htmlawed

If you're migrating from vanilla/htmlawed:

composer require eyupcanakman/htmlawed
composer remove vanilla/htmlawed

Usage

echo Htmlawed::filter('<h1>Hello world!');
// Outputs: '<h1>Hello world!</h1>'

echo Htmlawed::filter('<i>nothing to see</i><script>alert("xss")</script>');
// Outputs: '<i>nothing to see</i>alert("xss")'

// RSS filtering
echo Htmlawed::filterRSS('<html><body><h1>Hello world!</h1></body></html>');
// Outputs: '<h1>Hello world!</h1>'

See the htmLawed documentation for the full list of config and spec options.

Credits

License

LGPL-3.0 (same as the original package)

统计信息

  • 总下载量: 235
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 8
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: LGPL-3.0
  • 更新时间: 2026-03-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固