定制 el-schneider/statamic-html-minify 二次开发

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

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

el-schneider/statamic-html-minify

最新稳定版本:v2.0.0

Composer 安装命令:

composer require el-schneider/statamic-html-minify

包简介

An addon to minify HTML for Statamic v5

README 文档

README

Statamic v5 PHP Test Suite

A modern HTML minification addon for Statamic v5 that automatically compresses your website's HTML output, reducing page load times and bandwidth usage.

Features

  • Automatic HTML Minification: Compresses HTML on every request via middleware
  • Statamic v5 Compatible: Fully modernized for the latest Statamic version
  • Performance Optimized: Cached minification engine for optimal performance
  • Developer Friendly: Skip minification in debug mode during development
  • Highly Configurable: Comprehensive configuration with environment variable support
  • Error Resilient: Graceful fallback if minification fails
  • Production Ready: Battle-tested with comprehensive test suite

Installation

Install the addon via Composer:

composer require el-schneider/statamic-html-minify

Publish the configuration file:

php artisan vendor:publish --provider="ElSchneider\HtmlMinify\HtmlMinifyServiceProvider"

Configuration

The addon provides extensive configuration options via config/html-minify.php:

return [
    // Enable/disable minification entirely
    'enabled' => env('HTML_MINIFY_ENABLED', true),

    // Skip minification when APP_DEBUG is true
    'skip_on_debug' => env('HTML_MINIFY_SKIP_ON_DEBUG', false),

    // Minification options
    'removeComments' => env('HTML_MINIFY_REMOVE_COMMENTS', true),
    'sumUpWhitespace' => env('HTML_MINIFY_SUM_UP_WHITESPACE', true),
    'removeSpacesBetweenTags' => env('HTML_MINIFY_REMOVE_SPACES_BETWEEN_TAGS', true),

    // ... and many more options
];

Environment Variables

All configuration options support environment variables for easy deployment:

HTML_MINIFY_ENABLED=true
HTML_MINIFY_SKIP_ON_DEBUG=true
HTML_MINIFY_REMOVE_COMMENTS=true

Documentation

For detailed configuration options and advanced usage, see the DOCUMENTATION.md.

Requirements

  • PHP 8.2+
  • Statamic v5.0+
  • Laravel 10/11

Testing

Run the test suite:

vendor/bin/pest

Credits

This addon is maintained by el-schneider and builds upon the original work by:

Big thanks to Vaggelis for creating this addon and sharing it with the community! 🙏

License

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

Resources

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: Unknown
  • 更新时间: 2025-06-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固