PHPackages                             joas8211/html-composition - 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. joas8211/html-composition

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

joas8211/html-composition
=========================

HTML builder for PHP

1.0.3(5y ago)03[1 issues](https://github.com/joas8211/html-composition/issues)MITPHPPHP ^7.1.0

Since Nov 16Pushed 5y ago1 watchersCompare

[ Source](https://github.com/joas8211/html-composition)[ Packagist](https://packagist.org/packages/joas8211/html-composition)[ RSS](/packages/joas8211-html-composition/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (4)DependenciesVersions (4)Used By (0)

HTML Composition
================

[](#html-composition)

HTML builder for PHP

Features
--------

[](#features)

- Method chaining 🔗
- Optional pretty printing 😍
- Element or complete document rendering 🎨
- Configurable indentation 📝
- Code injection 💉

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

[](#installation)

### With Composer

[](#with-composer)

Install HTML Composition to your project with Composer:

```
composer require joas8211/html-composition
```

And require autoload.php if you haven't already:

```
require __DIR__ . '/vendor/autoload.php';
```

### Without Composer

[](#without-composer)

1. Download HtmlComposition.php from releases.
2. Require the file in the PHP file where you need it.

```
require 'HtmlComposition.php';
```

Usage
-----

[](#usage)

Example usage:

```
use HtmlComposition\HtmlComposition;

echo (new HtmlComposition)
    ->document()
    ->tag('html', ['lang' => 'en'])
        ->tag('head')
            ->tag('title')->text('Example Document')->end()
        ->end()
        ->tag('body')
            ->tag('h1')->text('Hello World!')->end()
            ->tag('img', [
                'src' => 'https://picsum.photos/768/432',
                'alt' => '',
            ], true)
        ->end()
    ->end();
```

Above code generates following HTML:

```

            Example Document

            Hello World!

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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 ~0 days

Total

3

Last Release

2008d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6506c06eeb54cb9be7127e738f536f14e6b3f2600bc7fa61f520349a279244f0?d=identicon)[Joas8211](/maintainers/Joas8211)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/joas8211-html-composition/health.svg)

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

PHPackages © 2026

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