timgws/cleanhtml
Composer 安装命令:
composer require timgws/cleanhtml
包简介
Quickly & Easily clean out HTML text, making sure that only the bare minimum is left behind
README 文档
README
Making HTML clean since late 2012!
Requirements
- PHP 5.2+
- php-xml
How to install
composer require timgws/cleanhtml
How to use
use timgws\CleanHTML\CleanHTML; $tidy = new CleanHTML(); $output = $tidy->clean('<p><strong>I need a shower. I am dirty HTML.</strong>');
$output should now contain:
<h2>I need a shower. I am dirty HTML.</h2>
Using the Clean function will remove tables, any Javascript or other non-friendly items that you might not want to see from user submitted HTML.
If you want to see some examples, the best place to look would be some of the CleanHTML test
What does it do?
- Removed additional spaces from HTML
- Replaces multiple
<br />tags with paragraph tags - Removes any
<script>tags - Renames any
<h1>tags to<h2> - Changes
<p><strong>tags to<h2> - Replaces
<h2><strong>with just<h2>tags - Removes weird
<p><span>tags - Uses HTML purifier to only allow h1,h2,h3,h4,h5,p,strong,b,ul,ol,li,hr,pre,code tags
- Runs steps 3->7 one more time, just to catch anything that might have missed by allowed tags
- Outputs nice clean HTML \o/
timgws/cleanhtml 适用场景与选型建议
timgws/cleanhtml 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 115 次下载、GitHub Stars 达 6, 最近一次更新时间为 2015 年 05 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sql」 「jquery」 「parser」 「ajax」 「query builder」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 timgws/cleanhtml 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 timgws/cleanhtml 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 timgws/cleanhtml 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Easy to use SDK with grabber for multiple platforms at once like YouTube, Dailymotion, Facebook and more.
Yii2 LightBox image galary widget uses Lightbox v2.10.0 by Lokesh Dhakar
Query filtering in your frontend
An MT940 bank statement parser for PHP
Database/ORM-agnostic query construction helper
This is a laravel 4 package for the server and client side of datatables at http://datatables.net/
统计信息
- 总下载量: 115
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 22
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-05-05