PHPackages                             neooblaster/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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. neooblaster/html

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

neooblaster/html
================

A JavaScript class to build DOM from JSON.

v1.4.0(7y ago)050[1 issues](https://github.com/neooblaster/HTML/issues)JavaScript

Since Mar 13Pushed 7y agoCompare

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

READMEChangelogDependenciesVersions (6)Used By (0)

HTML
====

[](#html)

Summary
-------

[](#summary)

Introduction
------------

[](#introduction)

HTML is a JavaScript "class" which simplify HTMLElement construction with a JSON Structure

Below, an example of HTML code generation from a simple JSON structure :

```
new HTML().compose({
    name: "div",
    classList: ["cl1", "cl2"],
    attributes:{
        style: "background-color: red;",
        "data-attr": "attr-value"
    },
    properties: {
        innerHTML: "Text with HTML balise"
    }
});
```

Will result :

```

Text with HTML balise

```

HTML Methods
------------

[](#html-methods)

### `compose`

[](#compose)

The `compose` method will generate the corresponding HTMLElements and return.

```
var structure = {};
new HTML().compose(structure);
```

### `composeTemplate`

[](#composetemplate)

Structure declaration
---------------------

[](#structure-declaration)

Declaration
-----------

[](#declaration)

Below, the algorithmic declaration :

```
STRUCTURE strListJSON
    name:  typeof String
    value: typeof Mixed
END STRUCTURE

STRUCTURE strListFunction
    function:   typeof function (callable)
    args:       typeof Array
END STRUCTURE

STRUCTURE strBuildHTML -- All attributes are optionnal
    name:       typeof String                   -- Stand for resulting tag name
    element:    typeof HTMLElement              -- to pass an existing HTMLElement
        (priority on name)

    classList:  typeof Array of String          -- List of CSS classes to append
    attributes: typeof Object using strListJSON -- List of HTML attribute to append
    properties: typeof Object using strListJSON -- List of HTML properties to append
    children:   typeof Array of strBuildHTML    -- Childs element to build and to append
    functions:  typeof Array of strListFunction -- List of function to execute before
        returning generated HTMLElement
END STRUCTURE

```

`name`
------

[](#name)

The attribute `name` of the structure `strBuildHTML` define the HTML tag to build. If the attribute `name` is missing, the default tag is `div`.

```
new HTML().compose({name: 'section'});
```

Will result :

```

```

`element`
---------

[](#element)

The attribute `element` of the structure `strBuildHTML` allows to bind an existing HTMLElement to manipulate with the class `HTML`.

```

    Title
    Paragraph

```

```
var element = document.querySelector('#article');

new HTML().compose({
    element: element,
    classList: ['font-size', 'text-decoration']
});
```

Will result :

```

    Title
    Paragraph

```

`classList`
-----------

[](#classlist)

The attribute `classList` of the structure `strBuildHTML` serves to add values provided in the HTML attribute `class`.

```
new HTML().compose({classList: ['class-1','class-2', 'class-3']});
```

Will result :

```

```

`attributes`
------------

[](#attributes)

The attribute `attributes` of the structure `strBuildHTML` allows you to add any HTML attribute with specified value (of type `String` or `Number` )

```
new HTML().compose({name: 'th', attributes: {colspan: 2}});
```

Will result :

```

```

`properties`
------------

[](#properties)

The attribute `properties` of the structure `strBuildHTML` is similare to `attributes`. It allows you to add/edit HTMLElement properties as-in a JavaScript script

```
new HTML().compose({properties: {textContent: 'Text Here'}});
```

Will result :

```
Text Here
```

`children`
----------

[](#children)

The attributes `children` of the structure `strBuildHTML` is a list of declaration of type `strBuildHTML` which will be appended to the current element.

```
new HTML().compose({
    name: 'table',
    children: [
        {
            name: 'tr',
            children: [
                {name: 'th', properties: {textContent: '#'}},
                {name: 'th', properties: {textContent: 'First Name'}},
                {name: 'th', properties: {textContent: 'Last Name'}},
                {name: 'th', properties: {textContent: 'Age'}}
            ]
        }
    ]
});
```

Will result :

```

        #
        First Name
        Last Name
        Age

```

`functions`
-----------

[](#functions)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity67

Established project with proven stability

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

Total

5

Last Release

2800d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/1fdc285ce1d3fb7fdf37d89b5f291e7e39b2772038ba28bfe3cf9d80f3d04c91?d=identicon)[neooblaster](/maintainers/neooblaster)

---

Top Contributors

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

---

Tags

jsonjavascripthtmldom

### Embed Badge

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

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[paquettg/php-html-parser

An HTML DOM parser. It allows you to manipulate HTML. Find tags on an HTML page with selectors just like jQuery.

2.4k7.9M123](/packages/paquettg-php-html-parser)[sunra/php-simple-html-dom-parser

Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.

1.3k9.4M61](/packages/sunra-php-simple-html-dom-parser)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1921.3M14](/packages/simplehtmldom-simplehtmldom)[scotteh/php-dom-wrapper

Simple DOM wrapper to select nodes using either CSS or XPath expressions and manipulate results quickly and easily.

1471.9M10](/packages/scotteh-php-dom-wrapper)[rct567/dom-query

DomQuery is a PHP library that allows easy 'jQuery like' DOM traversing and manipulation

134261.0k4](/packages/rct567-dom-query)

PHPackages © 2026

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