百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
T

tiny-html-minifier

> 前端框架
开源

使用单个类在 PHP 中压缩 HTML

186 stars0 点赞1 次浏览
访问官网GitHub

工具介绍

使用单个类在 PHP 中压缩 HTML

Tiny Html Minifier

Changelog

In short

  • A HTML minifier in PHP.
  • It's really really fast.
  • Only 1 file is required.
  • Almost no regular expressions.
  • Almost no options.

Details - What the minifier does

  • Remove HTML comments.
  • Remove slash in self closing elements. /> becomes >.
  • Remove type="text/css" and type="text/javascript" in style and script tags.
  • Minimize elements within ``. It will not keep any whitespace (except inside script).
  • Minimize elements within `` but keep spaces between tags to preserve inline data (optional).
  • Minimize inline SVG files (which are a bunch of XML tags).
  • Minimize Custom Elements. They look like this: My content.
  • Skip code, pre, script and textarea from being minified.

Install & usage

1. Download

ZIP

Download tiny-html-minifier.php or the whole ZIP.

Composer

You can install it with Composer as well.

2. Add the code

php

Tiny Html Minifier

    

After

xml
Tiny Html Minifier 
   

Options

php
 false,
    'disable_comments' => false,
]);

collapse_whitespace

Not collapsed

Spaces are preserved (except for most elements within ``). It's good when using the elements inline. This is the default.

xml

  My link 

  My link 
 

Collapsed

Spaces are collapsed. The text inside the element is still untouched. Set this value to true and you will save a few extra bytes.

xml

My link

My link

Requirements

  • PHP7+

Disclaimer

This plugin is provided "as is" with no guarantee. Use it at your own risk and always test it yourself before using it in a production environment. If you find any issues, please create a new issue.

License

MIT

It is discouraged to use this plugin in any project that promotes racism, sexism, homophobia, animal abuse, violence or any other form of hate speech.

Donate

If you want to make a donation, you can do that by sending any amount https://www.paypal.me/DevoneraAB

Credits

  • Jens Törnell

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

PHPcompresshtmlminifyminify-html

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类前端框架
定价开源

> 相关工具

R
React
用于构建用户界面的 JavaScript 库
V
Vue.js
渐进式 JavaScript 框架
N
Next.js
基于 React 的全栈 Web 框架