PHPackages                             wongyip/html-beautify - 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. wongyip/html-beautify

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

wongyip/html-beautify
=====================

HTML Formatter

v1.1.0(2y ago)22.5k↓33.3%12MITPHPPHP &gt;=8.2

Since Apr 8Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/wongyip/html-beautify)[ Packagist](https://packagist.org/packages/wongyip/html-beautify)[ Docs](https://github.com/wongyip/html-beautify)[ RSS](/packages/wongyip-html-beautify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (7)Used By (2)

HTML Beautify
=============

[](#html-beautify)

Based on the [Beautify HTML](https://github.com/ivanweiler/beautify-html) by [Ivan Weiler](https://github.com/ivanweiler), I'm here to bring it to the [Packagist](https://packagist.org/) only, no feature is added. Please find the original [`README`](org/README.md) for details.

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

[](#installation)

```
composer require wongyip/html-beautify
```

Usage
-----

[](#usage)

The same usage with the original [Beautify HTML](https://github.com/ivanweiler/beautify-html)is maintained, except of the namespaced classname. As in most cases (at least in most of my cases), `Beautify::class` will be used once only within the whole request/command life cycle, so a static `Beautify::html()` method is added to format HTML in a state-less manner.

```
use \Wongyip\HTML\Beautify;

$html =

    Title

        Hello
        World!

```

Options
-------

[](#options)

```
use \Wongyip\HTML\Beautify;

# All options are optional.
$options = [
    'indent_inner_html'     => false,
    'indent_char'           => " ",
    'indent_size'           => 4,
    'wrap_line_length'      => 32768,
    'unformatted'           => ['code', 'pre'],
    'preserve_newlines'     => false,
    'preserve_newlines_max' => 32768,
    'indent_scripts'        => 'normal',
];

# Set on instantiate.
$beautifier = new Beautify($options);

# Update option(s)
$beautifier->options(['indent_size' => 2]);

# Get options
$options = $beautifier->options();
```

Try it out
----------

[](#try-it-out)

```
composer create-project wongyip/html-beautify
cd html-beautify
composer install
php demo/demo.php
```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 55% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~2 days

Total

6

Last Release

755d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d49e948c3119a3b6a39247b96f577d4df2628b9a15583ef0fbf128b0b41d8622?d=identicon)[wongyip](/maintainers/wongyip)

---

Top Contributors

[![wongyip](https://avatars.githubusercontent.com/u/9350540?v=4)](https://github.com/wongyip "wongyip (11 commits)")[![ivanweiler](https://avatars.githubusercontent.com/u/568785?v=4)](https://github.com/ivanweiler "ivanweiler (4 commits)")[![DoxBoxCa](https://avatars.githubusercontent.com/u/259132932?v=4)](https://github.com/DoxBoxCa "DoxBoxCa (2 commits)")[![josep11](https://avatars.githubusercontent.com/u/5558911?v=4)](https://github.com/josep11 "josep11 (2 commits)")[![MatthieuScarset](https://avatars.githubusercontent.com/u/7369593?v=4)](https://github.com/MatthieuScarset "MatthieuScarset (1 commits)")

### Embed Badge

![Health badge](/badges/wongyip-html-beautify/health.svg)

```
[![Health](https://phpackages.com/badges/wongyip-html-beautify/health.svg)](https://phpackages.com/packages/wongyip-html-beautify)
```

###  Alternatives

[spomky-labs/cbor-php

CBOR Encoder/Decoder for PHP

576.4M30](/packages/spomky-labs-cbor-php)[cleaniquecoders/traitify

Traitify is a Laravel package designed to streamline and enhance your development process by providing a collection of reusable traits and contracts.

199.2k22](/packages/cleaniquecoders-traitify)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
