abordage/laravel-html-min 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

abordage/laravel-html-min

最新稳定版本:1.0.0

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.

Laravel HtmlMin

Packagist Version GitHub Tests Status GitHub Code Style Status PHP Version Support License

Features

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

Requirements

  • PHP 7.4 or higher (7.4, 8.0, 8.1, 8.2, 8.3, 8.4)
  • Laravel 8.x - 12.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

Option Default Description
enable true Enable/disable HTML minification
find_doctype_in_document true Skip minification if DOCTYPE not found
remove_whitespace_between_tags true Remove whitespace between tags
remove_blank_lines_in_script_elements false Remove blank lines in <script>
remove_trailing_slashes false Convert <link /> to <link>

See config/html-min.php for detailed descriptions.

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.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-06-13