PHPackages                             joby/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. [Templating &amp; Views](/categories/templating)
4. /
5. joby/html-object-strings

ActiveLibrary[Templating &amp; Views](/categories/templating)

joby/html-object-strings
========================

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

v2.2.3(4mo ago)031↓90%1MITPHPPHP ^8.1CI failing

Since Jul 12Pushed 4mo ago1 watchersCompare

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

READMEChangelog (6)Dependencies (8)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

39

—

LowBetter than 84% of packages

Maintenance77

Regular maintenance activity

Popularity8

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity54

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

127d 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/joby-html-object-strings/health.svg)

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

###  Alternatives

[phpunit/phpunit

The PHP Unit Testing framework.

20.0k955.1M155.1k](/packages/phpunit-phpunit)[dedoc/scramble

Automatic generation of API documentation for Laravel applications.

2.1k11.2M100](/packages/dedoc-scramble)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M508](/packages/pimcore-pimcore)[spiral/framework

Spiral, High-Performance PHP/Go Framework

2.1k2.2M66](/packages/spiral-framework)[oro/platform

Business Application Platform (BAP)

645143.5k115](/packages/oro-platform)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9421.6k61](/packages/open-dxp-opendxp)

PHPackages © 2026

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