承接 adriansuter/psr7-minify-middleware 相关项目开发

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

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

adriansuter/psr7-minify-middleware

Composer 安装命令:

composer require adriansuter/psr7-minify-middleware

包简介

PSR-7 Middleware that minifies the response body (HTML Minify).

README 文档

README

Latest Stable Version Build status Coverage Status Total Downloads License

Simple PSR-7 Middleware that minifies the response body. This middleware can be used to minify the html output.

By default, all textarea and pre sections would not be minified (ignored). This can be customized.

Installation

composer require adriansuter/psr7-minify-middleware

Usage

The constructor of this middleware has two parameters:

  • A callback that returns a new object implementing the Psr\Http\Message\StreamInterface in order to be able to minify the content.
  • The html elements (tag names) that should be ignored. This parameter is optional and defaults to the array ['textarea', 'pre'].

In Slim 3:

use AdrianSuter\PSR7\Middleware\Minify;
use Slim\Http\Body;

// Create the application $app
// [...]

$app->add(
    new Minify(
        function () {
            return new Body(fopen('php://temp', 'r+'));
        }
    )
);

In order to customize the html elements to be ignored, simply add a second parameter to the constructor:

$app->add(
    new Minify(
        function () {
            return new Body(fopen('php://temp', 'r+'));
        },
        ['script', 'textarea', 'pre', 'code']
    )
);

Testing

  • Unit tests: $ vendor/bin/phpunit

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-10-07

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固