Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Htmlcompressor Bundle Laravel Package

matthecat/htmlcompressor-bundle

Symfony bundle that automatically minifies HTML responses, stripping unnecessary whitespace and comments to reduce page size and speed up delivery. Simple to install and configure, it helps improve front-end performance without changing templates or application code.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Feature triage on the performance roadmap. This package exists to answer one narrow question: should HTML/XML response minification be in our request pipeline? It validates the concept (a kernel.response listener that minifies only cacheable responses) but does not validate the implementation for anything we'd ship in 2024+. Treat it as a reference design, not a dependency.
  • Build vs. buy, decided in favor of build. The "buy" option is effectively unavailable: archived repo, 11 stars, 0 dependents, Symfony2-era, no security response path. The functional surface is small enough that a 50–80 line response middleware in our own codebase (Laravel middleware or Symfony event subscriber) replaces it with no vendor risk. Decision: build, don't adopt.
  • Prioritization against higher-leverage perf work. Minification of HTML typically yields single-digit percentage savings on uncompressed payloads and near-zero savings once gzip/brotli is enabled — gzip already collapses repeated whitespace. If we're chasing Core Web Vitals or bandwidth, the ordering should be: compression → HTTP/CDN caching → image optimization → JS/CSS bundling → HTML minification. This package belongs at the bottom of that list, and its archived status means we shouldn't spend a sprint slot on it at all.
  • Framework-fit screening. Despite being catalogued here as a Laravel/PHP package, it is a Symfony2 bundle (MatTheCat\HtmlCompressorBundle), not a Laravel package. There is no service provider, no config publishing, no Laravel integration. For any Laravel codebase this is a non-starter without a rewrite; for Symfony it stops at 2.x.
  • Legacy estate decisions. The one genuine use case: we operate a Symfony 2.x app that cannot be upgraded this cycle and we want a low-effort, cacheable-only response minifier. Even then, the right move is to vendor/fork the listener (~a few hundred lines) rather than depend on an archived package.
  • Vendor-risk precedent. 0 dependents and archived status is a useful data point for our dependency policy: no new runtime dependency on a repo with no maintainer, regardless of how small the code is.

When to Consider This Package

Consider it only when all of the following hold:

  • You are on Symfony 2.x (not 3/4/5/6/7) and are not upgrading in the current planning horizon.
  • Your responses are already behind a cache (the bundle only touches responses marked cacheable), and you accept the minifier running on the cached-write path.
  • You have read the source (it is small) and are comfortable vendoring or forking it, since upstream will never ship a fix.
  • You have measured a real, material win — i.e., you are serving large HTML payloads without gzip/brotli and without a CDN that minifies.

Look elsewhere — or build — in every other case:

  • Any Laravel application. Wrong framework entirely; write a middleware or use an actively maintained equivalent (e.g. a page-speed/minify middleware package) instead.
  • Symfony 3+. Bundle registration, DI conventions, and PHP version constraints have all moved on; the archived code will not track them.
  • Any greenfield or actively upgraded codebase. Adding an archived dependency to a healthy codebase is a strict downgrade.
  • Anywhere gzip/brotli, a CDN (Cloudflare Auto Minify / Polish, Fastly, Akamai), or a build-time HTML minifier is already in play. The incremental gain rounds to noise and the added request-path risk is not worth it.
  • Any environment with compliance, SBOM, or supply-chain requirements. No maintainer means no CVE response, which fails most dependency policies outright.

How to Pitch It (Stakeholders)

To executives: We evaluated a minification add-on for HTML/XML responses. It is an archived, unmaintained Symfony2-era library with negligible adoption and no maintainer, and it does not fit our stack. The idea is sound but the payoff is small — low single-digit percent on uncompressed HTML, effectively zero once our compression and CDN are doing their job. Recommendation: do not adopt. If we want this capability, it is roughly a day of engineering as an in-house middleware with no vendor risk, and it should rank below compression, caching, and image optimization on the performance roadmap.

To engineering: The package is a thin kernel.response listener that runs htmlcompressor over responses flagged as cacheable. Two problems: it targets Symfony2 (not our framework of record), and it is archived with 0 dependents, so any bug or CVE is ours to fix forever. Proposed alternative: implement an equivalent response middleware in our own codebase — minify only cacheable, text/html and text/xml responses, skip when Content-Encoding is already set, gate behind a feature flag, and measure p50/p95 payload size with gzip on. If the measured win is under ~2% of transferred bytes, we ship nothing and close the ticket.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
cgv/localized-resource