voku/html-min
HtmlMin is a fast, easy-to-use PHP library that minifies HTML5 by stripping extra whitespace, comments, and unneeded characters without breaking structure. It also sorts attributes and CSS class names for better gzip compression, making pages smaller and faster to load.
text/html responses) rather than as a build-time step that's easy to bypass.Consider adopting when:
Look elsewhere or deprioritize when:
voku/html-min alongside alternatives with more active stewardship.<script>, <pre>, template syntax (Vue/Alpine/Blade directives), or conditional comments need careful validation. If you can't test the output, don't ship it.For executives — one paragraph: We can reduce the size of every HTML page we serve with a small, free, MIT-licensed PHP library added to our existing Laravel response pipeline. It removes unnecessary whitespace and comments, making pages smaller and faster to transfer without changing what users see. The cost is roughly one dependency and a few hours of integration and testing; it's fully reversible if results don't justify it. It is a tactical page-weight win — useful, measurable, and cheap — but not a substitute for our larger performance investments (image optimization, caching, JS reduction), and it does not change our hosting or compression strategy.
For engineering — the technical case:
text/html responses.Framing to avoid: don't position this as a performance strategy. Position it as a cheap, reversible optimization that buys a measurable increment while the team works on the changes that actually move the needle — and set that expectation before the ticket is opened, not after the results come in.
How can I help you explore Laravel packages today?