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

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

webtheory/html
==============

Create html strings from structured data

0.3.1(3y ago)11.2k7MITPHPPHP ^7.4||^8.0CI failing

Since Oct 29Pushed 1y ago1 watchersCompare

[ Source](https://github.com/spider-mane/html)[ Packagist](https://packagist.org/packages/webtheory/html)[ Docs](https://github.com/spider-mane/html)[ RSS](/packages/webtheory-html/feed)WikiDiscussions master Synced 5d ago

READMEChangelogDependencies (24)Versions (10)Used By (7)

html
====

[](#html)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2a81bf39b783d681dc80d945c0ed0e861a57399c83f8f8e0a104e9e5949c30b4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7765627468656f72792f68746d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webtheory/html)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/ca19da96821c31e2a90963d1d5282a1bd1947d95e392bdc8d76395a8c0822b75/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370696465722d6d616e652f68746d6c2f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spider-mane/html)[![Coverage Status](https://camo.githubusercontent.com/74170dcc697cbfac4d15de34a74cbfb8cb3e3b25f6659077c4bd9905c261ccb5/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f7370696465722d6d616e652f68746d6c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spider-mane/html/code-structure)[![Quality Score](https://camo.githubusercontent.com/42e9960e7d6bfc2685ca6b64f5c8c9862b55322aafde04821b9d46005f176d09/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370696465722d6d616e652f68746d6c2e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spider-mane/html)[![Total Downloads](https://camo.githubusercontent.com/6fba2136acdbf0828aa7d47732b891606f18de71fdbd79ee6959c84e18578655/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7765627468656f72792f68746d6c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/webtheory/html)

Clean interface for programmatically creating and manipulating html strings. Useful where desired output depends on various conditions or is otherwise fairly complex, but too brief to justify a template.

This project is still in early development.

Install
-------

[](#install)

Via Composer

```
composer require webtheory/html
```

Usage
-----

[](#usage)

Create one-offs by using the Html static class:

```
use WebTheory\Html\Html;
use WebTheory\Html\Attributes\ClassList;

$age = 24;

$attributes = [
    'id' => $age >= 21 ? 'real-id' : 'fake-id',
    'class' => new ClassList(['dummy-class', 'dummy-class-2']),
];

$content = 'This is a test';

echo Html::tag('h1', $content, $attributes);
```

Or create reusable elements by extending the AbstractHtmlElement class:

```
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Testing
-------

[](#testing)

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CODE\_OF\_CONDUCT](CODE_OF_CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Chris Williams](https://github.com/spider-mane)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity58

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

Recently: every ~170 days

Total

9

Last Release

1454d ago

PHP version history (4 changes)0.1.0PHP ^7.1

0.1.1PHP ^7.2

0.1.2PHP &gt;=7.2

0.3.0PHP ^7.4||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/42c6c17a141acad92bd90ad7b7e574ea19ecb332f33272a041261566670576cf?d=identicon)[webtheory](/maintainers/webtheory)

---

Top Contributors

[![spider-mane](https://avatars.githubusercontent.com/u/17187449?v=4)](https://github.com/spider-mane "spider-mane (27 commits)")

---

Tags

htmlwebtheory

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm, Rector

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-html

A fluent html builder

8376.4M72](/packages/spatie-laravel-html)[ckeditor/ckeditor

JavaScript WYSIWYG web text editor.

5234.2M76](/packages/ckeditor-ckeditor)[caxy/php-htmldiff

A library for comparing two HTML files/snippets and highlighting the differences using simple HTML.

21520.9M15](/packages/caxy-php-htmldiff)[yajra/laravel-datatables-html

Laravel DataTables HTML builder plugin

2899.6M48](/packages/yajra-laravel-datatables-html)[wa72/htmlpagedom

jQuery-inspired DOM manipulation extension for Symfony's Crawler

3383.9M34](/packages/wa72-htmlpagedom)[tinymce/tinymce

Web based JavaScript HTML WYSIWYG editor control.

1697.5M106](/packages/tinymce-tinymce)

PHPackages © 2026

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