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

ActiveLibrary

geeklab/html
============

Programmatically create HTML (XHTML, 4.x, 5) for PHP 5.3+

1.0.3(9y ago)126MITPHPPHP &gt;=5.3.0

Since Jul 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ellisgl/GeekLab-HTML)[ Packagist](https://packagist.org/packages/geeklab/html)[ RSS](/packages/geeklab-html/feed)WikiDiscussions release Synced 1mo ago

READMEChangelogDependenciesVersions (5)Used By (0)

GeekLab\\HTML
=============

[](#geeklabhtml)

Programmatically create HTML (HTML, 4.x, 5) for PHP 5.3+

### Todo

[](#todo)

- Add HTML 4.x and 5 support
- More methods
- API Docs

### Features

[](#features)

- Creates (X)HTML programmitically

### Installation

[](#installation)

Copy the src\\ folder to a folder GeekLab\\HTML where your autoloader can load it.

-OR-

Via Composer

composer.json

```
{
    "require":
    {
        "geeklab/html": "*"
    }
    "minimum-stability": "dev"
}
```

### Usage (From example\\index.php)

[](#usage-from-exampleindexphp)

```
/**
 * XHTML 1.0 Transitional, Language "en" and encoding of "UTF-8" no indention
 */
//$HTML = new GeekLab\HTML\HTML();

/**
 * XHTML 1.0 Transitional, Language "en" and encoding of "UTF-8" with indention
 */
//$HTML = new GeekLab\HTML\HTML(array('indent' => TRUE));

/**
 * XHTML 1.0 Strict, Language "en" and encoding of "UTF-8" with indention
 */
//$HTML = new GeekLab\HTML\HTML(array('indent' => TRUE, 'level' => 'strict')) ;

/**
 * XHTML 1.0 Strict, Language "fr" and encoding of "ISO-8859-1" with indention
 */
//$HTML = new GeekLab\HTML\HTML(array('indent' => TRUE, 'level' => 'strict', 'lang' => 'fr', 'encoding' => 'ISO-8859-1')) ;

/**
 * XHTML 1.1, Language "en" and encoding of "UTF-8" with indention
 */
//$HTML = new GeekLab\HTML\HTML(array('indent' => TRUE, 'version' => '1.1')) ;

/**
 * HTML 4.01, Language "en" with indention
 **/
//$HTML = new GeekLab\HTML(array('indent' => TRUE, 'docType' => 'html', 'version' => '4.01'));

/**
 * HTML5, Language "en" with indention
 */
$HTML = new GeekLab\HTML\HTML(array('indent' => TRUE, 'docType' => 'html', 'version' => '5'));

$HTML->open('head') // Create the head tag
     ->open('title', 'HTML Test') // Create the title tag with text
     ->close(2); // Close the previous 2 html tags

$HTML->open('body') // Create the body tag
     ->openClose('h1', 'Hello Wold') // Create and close an H1 tag with text
     ->openClose('hr') // Create and close an HR tag
     ->open('div', '', array('id' => 'myDiv')) // Create a div tag with an ID of 'myDiv'
     ->open('p') // Create a P tag
     ->addText('Testing 123!') // Add some text
     ->closeAll(); // Close all open tags.

echo $HTML->output(TRUE); // Out HTML wrapped with DOCType and HTML tags.
```

### API

[](#api)

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity61

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

Total

4

Last Release

3299d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2e7e44318db82444991c10456980f98ed1dbf109d5e84f85442e4349192411f1?d=identicon)[ellisgl](/maintainers/ellisgl)

---

Top Contributors

[![ellisgl](https://avatars.githubusercontent.com/u/94559?v=4)](https://github.com/ellisgl "ellisgl (26 commits)")

---

Tags

htmlphphtmlHTML5xhtml

### Embed Badge

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

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

###  Alternatives

[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M226](/packages/masterminds-html5)[xemlock/htmlpurifier-html5

HTML5 support for HTML Purifier

1052.9M11](/packages/xemlock-htmlpurifier-html5)[duzun/hquery

An extremely fast web scraper that parses megabytes of HTML in a blink of an eye. No dependencies. PHP5+

363146.3k4](/packages/duzun-hquery)[ressio/pharse

Fastest PHP HTML Parser

8478.4k](/packages/ressio-pharse)[oryzone/boilerplate-bundle

Integrates HTML5 boilerplate in symfony2 with twig

6120.5k](/packages/oryzone-boilerplate-bundle)[machy8/xhtml-formatter

Simple, lightweight, customizable (X)HTML and XML formatter / beautifier.

13181.6k6](/packages/machy8-xhtml-formatter)

PHPackages © 2026

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