PHPackages                             danielescherzer/html-builder - 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. danielescherzer/html-builder

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

danielescherzer/html-builder
============================

Tools for building HTML

v0.0.2(1y ago)2707↓100%MITPHPCI passing

Since Mar 26Pushed 10mo ago1 watchersCompare

[ Source](https://github.com/DanielEScherzer/html-builder)[ Packagist](https://packagist.org/packages/danielescherzer/html-builder)[ RSS](/packages/danielescherzer-html-builder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

HTML Builder
============

[](#html-builder)

About
-----

[](#about)

This composer library implements a set of utilities for build HTML output in PHP. It provides a fluent interface for manipulating attributes and building up the output.

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

[](#installation)

The library is meant to be installed via composer, e.g. using `composer require danielescherzer/html-builder`.

Usage
-----

[](#usage)

Strings used are escaped automatically, special handling is available for boolean and space-separated attributes. The primary entry point is the use of the `FluentHTML` class:

```
use DanielEScherzer\HTMLBuilder\FluentHTML;

$result = FluentHTML::fromTag( 'form' )
    ->setAttribute( 'id', 'submission-form' )
    ->setAttribute( 'class', [ 'my-project-forms', 'example-form' ] )
    ->addChild(
        FluentHTML::fromTag( 'label' )
            ->setAttribute( 'for', 'username-input' )
            ->addChild(
                ''
            )
    )
    ->addChild(
        FluentHTML::fromTag( 'input' )
            ->setAttribute( 'type', 'text' )
            ->setAttribute( 'name', 'username' )
            ->setAttribute( 'id', 'username-input' )
    )
    ->addChild(
        FluentHTML::fromTag( 'button' )
            ->setAttribute( 'type', 'submit' )
            ->setAttribute( 'disabled', true )
            ->addClass( 'btn-submit' )
            ->addChild( 'Submit' )
    )
    ->getHTML();
```

results in the following HTML (split across multiple lines for readability):

```

    &lt;username&gt;

    Submit

```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance54

Moderate activity, may be stable

Popularity20

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

2

Last Release

406d ago

### Community

Maintainers

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

---

Top Contributors

[![DanielEScherzer](https://avatars.githubusercontent.com/u/179652704?v=4)](https://github.com/DanielEScherzer "DanielEScherzer (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/danielescherzer-html-builder/health.svg)

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

###  Alternatives

[symfony/polyfill-php72

Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions

4.8k674.7M31](/packages/symfony-polyfill-php72)[symfony/polyfill-intl-icu

Symfony polyfill for intl's ICU-related data and classes

2.6k251.4M96](/packages/symfony-polyfill-intl-icu)[nette/php-generator

🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.5 features.

2.2k64.2M574](/packages/nette-php-generator)[consolidation/site-process

A thin wrapper around the Symfony Process Component that allows applications to use the Site Alias library to specify the target for a remote call.

5345.3M8](/packages/consolidation-site-process)[sycho/flarum-profile-cover

Adds the ability to add a cover image to a profile.

1836.6k](/packages/sycho-flarum-profile-cover)

PHPackages © 2026

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