PHPackages                             tei187/php-html-builder - 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. tei187/php-html-builder

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

tei187/php-html-builder
=======================

Generating HTML output.

031PHP

Since Aug 8Pushed 2y ago1 watchersCompare

[ Source](https://github.com/tei187/php-html-builder)[ Packagist](https://packagist.org/packages/tei187/php-html-builder)[ RSS](/packages/tei187-php-html-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

**PHP-TO-HTML package**
=======================

[](#php-to-html-package)

**About**
---------

[](#about)

---

Scripts meant to help out with organizing HTML tag building through PHP, for a rather specific one case but makes sense enough to try out, if you really don't want/need Twig :D

### **Features:**

[](#features)

- **Basic HTML** builder (content, forms, all the parts of HEAD you tend to google for),
- **Bootstrap** equivalent builder,
- **Constants** for Charset, Doctype and Vocabularies,
- **OpenGraph** handling: namespaces, default types, Twitter.

**Installation**
----------------

[](#installation)

---

### **Composer**

[](#composer)

```
    composer require tei187/php-html-builder
```

**Examples**
------------

[](#examples)

---

### **Basic HTML**

[](#basic-html)

#### *Input:*

[](#input)

```
    use tei187\HTMLBuilder\Constants\Charset;
    use tei187\HTMLBuilder\HTML;
    use tei187\HTMLBuilder\Head;
    use tei187\HTMLBuilder\OpenGraph;
    use tei187\HTMLBuilder\OpenGraph\Prefixes;

    echo
        HTML::Doctype() .
        HTML::Html( [ 'prefix' => Prefixes::og, 'lang' => "en-US" ],
            HTML::Head(
                Head::Charset( Charset::UTF8 ) .
                Head::Title("Testing page") .
                OpenGraph::Type('website') .
                OpenGraph::Url('localhost') .
                OpenGraph::SiteName("Testing page") .
                OpenGraph::Description("Just a testing page for HTML builder based on PHP") .
                Head::StyleSheet("/assets/css/style.min.css")
            ) .
            HTML::Body( [ 'class' => "main" ],
                HTML::Heading( 1, [ 'class' => 'text-red' ], "Hello World!" ) .
                HTML::Paragraph( [], "Paragraph example" )
            )
        );
```

#### *Output:*

[](#output)

```
>

        Testing page

        Hello World!
        Paragraph example

```

---

### **Bootstrap**

[](#bootstrap)

#### *Input:*

[](#input-1)

```
    use tei187\HTMLBuilder\HTML;
    use tei187\HTMLBuilder\Head;
    use tei187\HTMLBuilders\Bootstrap;

    echo
        HTML::Doctype() .
        HTML::Html([],
            HTML::Head(
                Head::Charset() .
                Head::Viewport() .
                Head::Title("Bootstrap Example") .
                Head::StyleSheet(
                    "https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css",
                    null,
                    [
                        'integrity' => "sha384-rbsA2VBKQhggwzxH7pPCaAqO46MgnOM80zW1RWuH61DGLwZJEdK2Kadq2F9CUG65",
                        'crossorigin' => "anonymous",
                    ]
                )
            ) .
            HTML::Body([],
                Bootstrap::Container([],
                    HTML::Heading(1, [], "Heading") .
                    Bootstrap::Row([],
                        Bootstrap::Col(['class' => 'col-12 col-md-6'],
                            HTML::Image(['alt' => 'Image alternative text'], "/assets/img/image.jpg") .
                            HTML::Paragraph([], "Paragraph")
                        )
                    )
                ) .
                HTML::Script(
                    [
                        'src' => "https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js",
                        'integrity' => "sha384-kenU1KFdBIe4zVF0s0G1M5b4hcpxyD9F7jL+jjXkk+Q2h455rYXK/7HAuoJl+0I4",
                        'crossorigin' => "anonymous",
                    ]
                )
            )
        );
```

#### *Output:*

[](#output-1)

```
>

        Bootstrap Example

            Heading

                    Paragraph

```

**Requires**
------------

[](#requires)

---

- **UtilitiesPHP** : *tei187/utilities-php* ([GitHub](https://github.com/tei187/UtilitiesPHP) | [Packagist](https://packagist.org/packages/tei187/utilities-php))

**Author**
----------

[](#author)

---

- [tei187](https://github.com/tei187)

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 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.

### Community

Maintainers

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

---

Top Contributors

[![tei187](https://avatars.githubusercontent.com/u/59267193?v=4)](https://github.com/tei187 "tei187 (39 commits)")

---

Tags

csshtmlhtml-generatoropengraphphp-htmlphp74twitter

### Embed Badge

![Health badge](/badges/tei187-php-html-builder/health.svg)

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

PHPackages © 2026

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