承接 searchturbine/phpwee-php-minifier 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

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:

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.

Performance Graph

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.

统计信息

  • 总下载量: 2.46k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 83
  • 点击次数: 2
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 81
  • Watchers: 5
  • Forks: 44
  • 开发语言: PHP

其他信息

  • 授权协议: BSD
  • 更新时间: 2015-03-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固