searchturbine/phpwee-php-minifier
Composer 安装命令:
composer require searchturbine/phpwee-php-minifier
包简介
A PHP minifier for HTML, CSS and JS files.
关键字:
README 文档
README
PHPWee is an inline PHP minifier for web resources. It lets you minify HTML4, HTML5, XHTML, CSS and JavaScript files in a single line of code.
The best bit is its free and open source under the BSD license.
Installing PHPWee
Installing PHPWee should only take a minute. Here are you 3 choices:
- Download from SearchTurbine.com - http://searchturbine.com/downloads/community/phpwee.zip
- Install a Composer package form Packagist.com - https://packagist.org/packages/searchturbine/phpwee-php-minifier
- Hit the 'Download Zip' button on GitHub.
You can include all the necessary classes by simply including the phpwee-php-minifier/phpwee.php file.
require_once ("phpwee-php-minifier/phpwee.php");
Using PHPWee
How to compress HTML:
$minified_html = PHPWee\Minify::html($any_html);
This automatically compresses all inline scripts and stylesheets within the HTML document. Apply a 'data-no-min' attribute to a script or style to exclude it from minification.
How to compress CSS:
$minified_css = PHPWee\Minify::css($any_css);
How to compress JS:
$minified_js = PHPWee\Minify::js($any_js);
Spelling out out:
require_once ("phpwee-php-minifier/phpwee.php"); $html = file_get_contents("http://en.wikipedia.org/wiki/Minification_%28programming%29"); $minified_html = PHPWee\Minify::html($html); // a 9.38% performance boost - in 3 lines of code!!
There are working examples in the /examples folder of the package.
PHPWee Performance
- The compression ratio are typically 5-20% for HTML
- The compression ratio are typically 5-30% for CSS
- The compression ratio are typically 5-30% for JavaScript
Even highly optimized sites such as wikipedia.com, github.com and W3Schools.com can reduce the size of their HTML payload using PHPWee html compression.
Who Makes PHPWee ?
The PHPWee HTML compression technology is totally new. It actually parses HTML documents and removes unneeded spaces and verbosity without changing meaning in any way. The output is generally at least as W3C compliant as the input.
The Css compressor is built upon the CssMin package by Joe Scylla joe.scylla@gmail.com. The JavaScript compressor is built upon Douglas Crockford's JSMin.
PHPWee Purpose
PHPWee is built and maintained by http://searchturbine.com as part of their 20% codeshare policy. They can be contacted at community@seacrhturbine.com
PHPWee was designed as a pre-CDN optimizer for the searchturbine.com website - which is hosted on Github pages. It currently offers about 22% compression site-wide - and is used in the deployment process.
This technology would is ideally placed to be used in deployment scripts for websites, and would also fair wall as part of a CDN architecture.
PHPWee Improvements
- We are relatively new to Composer - and welcome input on package improvements.
- Removing default values from html tags should reduce HTML file size
- Allowing HTML fragments rather than whole documents would be ideal.
We "eat our own dog-food". We will be using this package to optimize http://searchturbine.com - and will publish all results, insights and improvements.
searchturbine/phpwee-php-minifier 适用场景与选型建议
searchturbine/phpwee-php-minifier 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.46k 次下载、GitHub Stars 达 81, 最近一次更新时间为 2015 年 03 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「javascript」 「css」 「JS」 「HTML5」 「CSS3」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 searchturbine/phpwee-php-minifier 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 searchturbine/phpwee-php-minifier 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 searchturbine/phpwee-php-minifier 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Generates a Blade directive exporting all of your named Laravel routes. Also provides a nice route() helper function in JavaScript.
A Twig extension to insert css as inline styles with a tag
Caching and compression for Twig assets (JavaScript and CSS).
A pretty nice way to expose your translation messages to your JavaScript.
PHP client for the Google Closure Compiler API in one file.
Yii2 integration for AirBnB Polyglot.js
统计信息
- 总下载量: 2.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 83
- 点击次数: 13
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD
- 更新时间: 2015-03-25