PHPackages                             pear/html\_common2 - 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. pear/html\_common2

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

pear/html\_common2
==================

Abstract base class for HTML classes (PHP5 port of HTML\_Common package).

v2.3.1(4y ago)1526.1k↑22%23BSD-3-ClausePHPPHP &gt;=5.6.0

Since Feb 17Pushed 4y ago10 watchersCompare

[ Source](https://github.com/pear/HTML_Common2)[ Packagist](https://packagist.org/packages/pear/html_common2)[ Docs](https://pear.php.net/package/HTML_Common2)[ RSS](/packages/pear-html-common2/feed)WikiDiscussions trunk Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (3)

HTML\_Common2
=============

[](#html_common2)

[![Build Status](https://github.com/pear/HTML_Common2/workflows/Continuous%20Integration/badge.svg?branch=trunk)](https://github.com/pear/HTML_Common2/actions?query=branch%3Atrunk+workflow%3A%22Continuous+Integration%22)

This is a repository for [PEAR HTML\_Common2](http://pear.php.net/package/HTML_Common2/) package that has been migrated from [PEAR SVN](https://svn.php.net/repository/pear/packages/HTML_Common2).

The package contains an abstract `HTML_Common2` class that implements methods for HTML attributes handling and setting document-wide options. It is quite helpful as a building block for packages generating HTML and is currently used as such by [PEAR HTML\_QuickForm2](http://pear.php.net/package/HTML_QuickForm2/) package. The package is a PHP5 rewrite of [PEAR HTML\_Common](http://pear.php.net/package/HTML_Common/).

Features:

- Allows [easy setting, removing, merging of HTML attributes](http://pear.php.net/manual/en/package.html.html-common2.attributes.php), working with CSS classes;
- Provides means to parse and generate HTML attribute strings;
- Global [document options](http://pear.php.net/manual/en/package.html.html-common2.options.php): charset, linebreak and indentation characters;
- Methods to handle indentation and HTML comments (useful in subclasses).

Please report all issues via the [PEAR bug tracker](http://pear.php.net/bugs/search.php?cmd=display&package_name%5B%5D=HTML_Common2) or [Github issues](https://github.com/pear/HTML_Common2/issues).

[End-user documentation](http://pear.php.net/manual/en/package.html.html-common2.php) as well as [generated API documentation](http://pear.php.net/package/HTML_Common2/docs/latest/) for current release is available on PEAR website.

Pull requests are welcome.

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

[](#installation)

The package may be installed either with PEAR

```
$ pear install HTML_Common2

```

or with composer

```
$ composer require pear/html_common2

```

Note that `composer.json` does not define `include-path` option: `require_once 'HTML/Common2.php'` will not work with composer installation, use autoloading.

Testing, Packaging and Installing (Pear)
----------------------------------------

[](#testing-packaging-and-installing-pear)

To test, run either

```
$ phpunit tests/

```

or

```
$ pear run-tests -r

```

To build, simply

```
$ pear package

```

To install from scratch

```
$ pear install package.xml

```

To upgrade

```
$ pear upgrade -f package.xml

```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity39

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 92.9% 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 ~710 days

Total

5

Last Release

1509d ago

PHP version history (2 changes)v2.2.0PHP &gt;=5.4.0

v2.3.0PHP &gt;=5.6.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/4b43550745afa89d33e4b93f8535fc31c93ac0a712d264c13cb8f8c62d9198c1?d=identicon)[sad-spirit](/maintainers/sad-spirit)

---

Top Contributors

[![sad-spirit](https://avatars.githubusercontent.com/u/4820288?v=4)](https://github.com/sad-spirit "sad-spirit (52 commits)")[![till](https://avatars.githubusercontent.com/u/27003?v=4)](https://github.com/till "till (3 commits)")[![CloCkWeRX](https://avatars.githubusercontent.com/u/365751?v=4)](https://github.com/CloCkWeRX "CloCkWeRX (1 commits)")

---

Tags

htmlPEARattributeelement

### Embed Badge

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

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

###  Alternatives

[phpoffice/phpword

PHPWord - A pure PHP library for reading and writing word processing documents (OOXML, ODF, RTF, HTML, PDF)

7.6k34.7M186](/packages/phpoffice-phpword)[latte/latte

☕ Latte: the intuitive and fast template engine for those who want the most secure PHP sites. Introduces context-sensitive escaping.

1.3k15.7M683](/packages/latte-latte)[twig/string-extra

A Twig extension for Symfony String

22046.0M133](/packages/twig-string-extra)[exercise/htmlpurifier-bundle

HTMLPurifier integration for your Symfony project

27911.3M16](/packages/exercise-htmlpurifier-bundle)[twig/markdown-extra

A Twig extension for Markdown

12114.3M83](/packages/twig-markdown-extra)[laminas/laminas-view

Fast and type safe HTML templating library with a flexible plugin system supporting multistep template composition

7526.3M230](/packages/laminas-laminas-view)

PHPackages © 2026

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