定制 abordage/laravel-html-min 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

abordage/laravel-html-min

最新稳定版本:0.2.2

Composer 安装命令:

composer require abordage/laravel-html-min

包简介

HtmlMin is very simple (and very fast) html compression package for Laravel

README 文档

README

HtmlMin: Laravel package for HTML minification

Very simple (and very fast) html compression.

Packagist Version Scrutinizer Quality Score GitHub Tests Status GitHub Code Style Status PHP Version Support License

Features:

  • Removing extra whitespaces
  • Removing html comments (works correctly with livewire/livewire comments)
  • Skip textarea, pre and script elements
  • Very fast. See benchmark

Requirements

  • PHP 7.4 - 8.3
  • Laravel 8.x - 11.x

Installation

You can install the package via composer:

composer require abordage/laravel-html-min

You can publish the config file with:

php artisan vendor:publish --tag="html-min-config"

Usage

To enable compression just register middleware:

// app/Http/Kernel.php

protected $middleware = [
    'web' => [
        // other middleware
        
        \Abordage\LaravelHtmlMin\Middleware\HtmlMinify::class,
    ],
    
    // ...
];

It's all. Optionally you can change the settings in config/html-min.php

Configuration

return [
    /*
    |--------------------------------------------------------------------------
    | Enable Html Min
    |--------------------------------------------------------------------------
    */
    'enable' => env('HTML_MINIFY', true),

    /*
    |--------------------------------------------------------------------------
    | Find DOCTYPE in document
    |--------------------------------------------------------------------------
    */
    'find_doctype_in_document' => true,

    /*
    |--------------------------------------------------------------------------
    | Remove whitespace between tags
    |--------------------------------------------------------------------------
    */
    'remove_whitespace_between_tags' => true,

    /*
    |--------------------------------------------------------------------------
    | Remove blank lines in script elements
    |--------------------------------------------------------------------------
    */
    'remove_blank_lines_in_script_elements' => false,
];

Benchmark

See abordage/html-min-benchmark

Testing

composer test:all

or

composer test:phpunit
composer test:phpstan
composer test:phpcsf

or see https://github.com/abordage/laravel-html-min/actions/workflows/tests.yml

Feedback

If you have any feedback, comments or suggestions, please feel free to open an issue within this repository.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

  • Stars: 25
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 未知

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固