PHPackages                             byjoby/html-object-strings - 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. byjoby/html-object-strings

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

byjoby/html-object-strings
==========================

A comprehensive PHP library for programmatically building HTML. Covers essentially all of HTML5, plus SVG and MathML.

v2.2.3(2mo ago)01.9k1MITPHPPHP ^8.1CI failing

Since Jul 12Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/joby-lol/html-object-strings)[ Packagist](https://packagist.org/packages/byjoby/html-object-strings)[ RSS](/packages/byjoby-html-object-strings/feed)WikiDiscussions v2 Synced 1w ago

READMEChangelog (6)Dependencies (4)Versions (8)Used By (1)

HTML Object Strings
===================

[](#html-object-strings)

A comprehensive PHP library for programmatically building HTML. Covers essentially all of HTML5.

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

[](#installation)

```
composer require joby/html-object-strings
```

Usage
-----

[](#usage)

Tags live in the `Joby\HTML\Html5` namespace. Find the tag class you need, instantiate it, and use the fluent setters to configure it. Every attribute and behavior is documented in the class and method docblocks, sourced from MDN.

```
use Joby\HTML\Html5\InlineTextSemantics\ATag;
use Joby\HTML\Html5\TextContentTags\DivTag;
use Joby\HTML\Nodes\Text;

$div = new DivTag();
$div->addChild(
    (new ATag())
        ->setHref('https://example.com')
        ->addChild(new Text('Click here'))
);

echo $div;
```

Parsing
-------

[](#parsing)

HTML can be parsed back into the object model using `Html5Parser`. This feature is still somewhat experimental.

```
use Joby\HTML\Html5\Html5Parser;

$parser = new Html5Parser();

// Parse a fragment into a container of nodes
$fragment = $parser->parseFragment('Hello');

// Parse a full document
$document = $parser->parseDocument('My Pagefoo');
echo $document->html()->head()->title()->content(); // "My Page"
```

Unknown tags and whitespace-only text nodes are silently dropped. Parsed nodes are full objects — attributes, classes, and styles are all accessible and mutable.

The parser is extensible: subclass `AbstractParser` or `Html5Parser` and configure `$tag_namespaces` and `$tag_classes` to support custom tag sets.

Traversal
---------

[](#traversal)

Any container — parsed or built programmatically — can be walked recursively using `walk()`. It yields all descendant nodes depth-first, optionally filtered by class:

```
use Joby\HTML\Html5\InlineTextSemantics\ATag;

// Find all links in a parsed fragment and rewrite their hrefs
foreach ($fragment->walk(ATag::class) as $link) {
    $link->setHref('https://proxy.example.com?url=' . urlencode($link->href()));
}

// Walk all nodes without filtering
foreach ($fragment->walk() as $node) {
    echo get_class($node) . PHP_EOL;
}
```

Requirements
------------

[](#requirements)

Fully tested on PHP 8.3+, static analysis for PHP 8.1.

License
-------

[](#license)

MIT License - See [LICENSE](LICENSE) file for details.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance84

Actively maintained with recent releases

Popularity16

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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

Recently: every ~0 days

Total

8

Last Release

82d ago

Major Versions

v1.x-dev → v2.0.02026-02-23

PHP version history (2 changes)v1.x-devPHP &gt;=7.1

v2.0.0PHP ^8.1

### Community

Maintainers

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

---

Top Contributors

[![joby-lol](https://avatars.githubusercontent.com/u/856610?v=4)](https://github.com/joby-lol "joby-lol (56 commits)")

---

Tags

domdom-manipulationhtmlhtml5phpphp-library

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/byjoby-html-object-strings/health.svg)

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

###  Alternatives

[nahid/qarray

QArray is a PHP abstraction for querying array

108403.2k2](/packages/nahid-qarray)[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21421.6k](/packages/imanghafoori-laravel-anypass)[laravolt/semantic-form

Semantic UI form helpers

5213.0k2](/packages/laravolt-semantic-form)[isolate/unit-of-work

Unit of Work

2323.1k5](/packages/isolate-unit-of-work)[dragon-code/size-sorter

Easily sort clothing size, height, bra size, furniture size and more

3915.4k](/packages/dragon-code-size-sorter)[heptacom/heptaconnect-portal-base

HEPTAconnect base dataset that every other portal is based on

1024.9k13](/packages/heptacom-heptaconnect-portal-base)

PHPackages © 2026

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