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

ActiveMouf-library

mouf/html.htmlelement
=====================

This package contains the HtmlElementInterface interface that can be used to output HTML on a page. It also features base classes implementing this interface.

v2.0.1(7y ago)2370.4k↓35.2%3[1 PRs](https://github.com/thecodingmachine/html.html_element/pulls)14MITPHPPHP &gt;=5.3.0

Since Jun 3Pushed 7y ago2 watchersCompare

[ Source](https://github.com/thecodingmachine/html.html_element)[ Packagist](https://packagist.org/packages/mouf/html.htmlelement)[ Docs](https://github.com/thecodingmachine/html.html_element)[ RSS](/packages/mouf-htmlhtmlelement/feed)WikiDiscussions 2.0 Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (4)Used By (14)

What is this package?
=====================

[](#what-is-this-package)

This package contains an interface used to render objects in HTML. Basically, instances of classes implementing this interface provide a toHtml method that can be used to get some HTML.

The concept is very abstract, but also very powerful. Let's take a sample:

- you might write a "HtmlButtonElement" class that would render a simple HTML button.
- you might write a "HtmlCalendarElement" class that would render a calendar.
- you might write a "HtmlTemplateElement" class that would render a full template.
- ...

Obviously, this package is useless on its own. It is useful only if you implement the interface in your classes.

In practice
-----------

[](#in-practice)

Implementing the HtmlElementInterface is simple stupid: just add a "toHtml" method to your code:

```
/**
 * Renders the object in HTML.
 * The Html is echoed directly into the output.
 */
function toHtml();

```

Provided classes
----------------

[](#provided-classes)

This package comes with a few classes implementing the HtmlElementInterface:

- **HtmlString**: this class contains a string that is outputed when you call the toHtml method
- **HtmlFromFile**: this class refers to a PHP file that is required when you call the toHtml method
- **HtmlFromFunction**: this class refers to a PHP callable (method, function, ...) that is called when you call the toHtml method

Mouf package
------------

[](#mouf-package)

This package is part of [Mouf](http://mouf-php.com), an effort to ensure good developing practices by providing a graphical dependency injection framework.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity36

Limited adoption so far

Community23

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% 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 ~514 days

Total

4

Last Release

2826d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1104771?v=4)[mouf](/maintainers/mouf)[@Mouf](https://github.com/Mouf)

---

Top Contributors

[![moufmouf](https://avatars.githubusercontent.com/u/1290952?v=4)](https://github.com/moufmouf "moufmouf (15 commits)")[![nguyenk](https://avatars.githubusercontent.com/u/2227554?v=4)](https://github.com/nguyenk "nguyenk (1 commits)")[![vaidiep](https://avatars.githubusercontent.com/u/2227695?v=4)](https://github.com/vaidiep "vaidiep (1 commits)")

---

Tags

htmlinterfacetohtml

### Embed Badge

![Health badge](/badges/mouf-htmlhtmlelement/health.svg)

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

###  Alternatives

[ezyang/htmlpurifier

Standards compliant HTML filter written in PHP

3.3k327.6M445](/packages/ezyang-htmlpurifier)[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)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M229](/packages/masterminds-html5)[league/html-to-markdown

An HTML-to-markdown conversion helper for PHP

1.9k28.6M199](/packages/league-html-to-markdown)[picqer/php-barcode-generator

An easy to use, non-bloated, barcode generator in PHP. Creates SVG, PNG, JPG and HTML images from the most used 1D barcode standards.

1.8k25.5M88](/packages/picqer-php-barcode-generator)[nette/robot-loader

🍀 Nette RobotLoader: high performance and comfortable autoloader that will search and autoload classes within your application.

89352.7M321](/packages/nette-robot-loader)

PHPackages © 2026

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