PHPackages                             wa72/html-pretty-min - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. wa72/html-pretty-min

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wa72/html-pretty-min
====================

HTML minifier and indenter that works on the DOM tree

v0.3.1(1y ago)22231.3k↓44.8%9[4 issues](https://github.com/wasinger/html-pretty-min/issues)8MITPHPPHP &gt;=8

Since Nov 5Pushed 1y ago3 watchersCompare

[ Source](https://github.com/wasinger/html-pretty-min)[ Packagist](https://packagist.org/packages/wa72/html-pretty-min)[ RSS](/packages/wa72-html-pretty-min/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (8)Dependencies (4)Versions (9)Used By (8)

HTML Pretty-Min
===============

[](#html-pretty-min)

[![tests](https://github.com/wasinger/html-pretty-min/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/wasinger/html-pretty-min/actions/workflows/tests.yml/badge.svg?branch=master)[![Latest Version](https://camo.githubusercontent.com/379ed396fbbd8a9c7c2c794395481a13dae684bc45ba9a3970ecb942fa025b2b/687474703a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f776137322f68746d6c2d7072657474792d6d696e2e737667)](https://packagist.org/packages/wa72/html-pretty-min)

HTML Pretty-Min is a PHP library for minifying and prettyprinting (indenting) HTML documents that works directly on the DOM tree of an HTML document.

Currently, it has the following features:

- **Prettyprint**:

    - Indent Block-level elements, do not indent inline elements
- **Minify**:

    - Remove whitespace and newlines
    - Compress embedded Javascript using [mrclay/jsmin-php](https://packagist.org/packages/mrclay/jsmin-php)
    - Compress embedded CSS using [tubalmartin/cssmin](https://packagist.org/packages/tubalmartin/cssmin)
    - Remove some attributes when their value is empty (by default "style" and "class" attributes)
    - Remove comments, except those matching some given regular expressions (by default, IE conditional comments are kept)

Installation
------------

[](#installation)

HTML Pretty-Min is listed on [Packagist](https://packagist.org/packages/wa72/html-pretty-min).

`composer require wa72/html-pretty-min`

Usage
-----

[](#usage)

```
