wyrihaximus / html-compress
压缩/精简您的HTML
4.3.0
2024-06-08 19:50 UTC
Requires
- php: ^8.2
- thecodingmachine/safe: ^2.2
- voku/html-min: ^4.5.1
- voku/simple_html_dom: ^4.8.9
- wyrihaximus/compress: ^2.0
- wyrihaximus/compress-contracts: ^1
- wyrihaximus/css-compress: ^2
- wyrihaximus/js-compress: ^5
Requires (Dev)
- wyrihaximus/test-utilities: ^6.0.7
- dev-master
- 4.3.0
- 4.2.1
- 4.2.0
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.0
- 3.x-dev
- 3.0.0
- 2.0.1
- 2.0.0
- 1.4.x-dev
- 1.4.0
- 1.3.x-dev
- 1.3.1
- 1.3.0
- 1.2.1
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.1
- 1.0.0
- dev-dependabot/composer/composer/composer-2.7.7
- dev-cs-fixes
- dev-run-ci-on-php-8
- dev-make-HtmlMin-injectable
- dev-conditionals
- dev-nocompress
- dev-esi/fix-79
This package is auto-updated.
Last update: 2024-09-10 22:22:59 UTC
README
安装
要通过Composer安装,请使用以下命令,它将自动检测最新版本并将其绑定到~
。
composer require wyrihaximus/html-compress
基本用法
<?php require dirname(__DIR__) . '/vendor/autoload.php'; $parser = Factory::constructSmallest(); $compressedHtml = $parser->compress($sourceHtml);
高级用法
所有工厂方法都有一个WithHtmlMin
变体,允许您设置底层HtmlMin
实例的选项
<?php require dirname(__DIR__) . '/vendor/autoload.php'; $htmlMin = new HtmlMin(); $htmlMin->doRemoveHttpPrefixFromAttributes(); $htmlMin->doMakeSameDomainsLinksRelative(['example.com']); $parser = Factory::constructSmallest()->withHtmlMin($htmlMin); $compressedHtml = $parser->compress($sourceHtml);
集成
许可证
版权所有 2019 Cees-Jan Kiewiet
特此授予任何获得本软件及其相关文档副本(“软件”)的人免费使用软件的权利,不受限制地处理软件,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或出售软件副本,并允许向软件提供副本的人这样做,前提是满足以下条件
上述版权声明和本许可声明应包含在软件的任何副本或实质性部分中。
本软件按“原样”提供,不提供任何明示或暗示的保证,包括但不限于适销性、针对特定目的的适用性和非侵权性保证。在任何情况下,作者或版权持有人不对任何索赔、损害或其他责任承担责任,无论此类责任是基于合同、侵权或其他方式,是否因软件或其使用或其他方式而产生、产生于或与其有关。