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

ActiveMouf-library[Templating &amp; Views](/categories/templating)

mouf/html.template.templateinterface
====================================

This package contains the definition of an HTML template (the TemplateInterface interface) and an helper class to build HTML templates easily (the BaseTemplate class).

v3.0.0(3y ago)0359.0k↓53.7%1[1 issues](https://github.com/thecodingmachine/html.template.templateinterface/issues)7MITPHPPHP ^8.0

Since Feb 6Pushed 3y ago1 watchersCompare

[ Source](https://github.com/thecodingmachine/html.template.templateinterface)[ Packagist](https://packagist.org/packages/mouf/html.template.templateinterface)[ Docs](https://github.com/thecodingmachine/html.template.templateinterface)[ RSS](/packages/mouf-htmltemplatetemplateinterface/feed)WikiDiscussions 3.0 Synced yesterday

READMEChangelog (1)Dependencies (7)Versions (6)Used By (7)

[![Latest Stable Version](https://camo.githubusercontent.com/681ace3be7264f4373f7abf0264f6e92c457169ec046543fc842df1213fc294d/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f68746d6c2e74656d706c6174652e74656d706c617465696e746572666163652f762f737461626c652e737667)](https://packagist.org/packages/mouf/html.template.templateinterface)[![Total Downloads](https://camo.githubusercontent.com/2e12a0a9d925dbe0848c87a493da3f8dad3a4577be1a571aa0df30f737cc1d88/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f68746d6c2e74656d706c6174652e74656d706c617465696e746572666163652f646f776e6c6f6164732e737667)](https://packagist.org/packages/mouf/html.template.templateinterface)[![Latest Unstable Version](https://camo.githubusercontent.com/d43f9291cc35c4f7e9b1409e2f0342c3815e7c53ed99b572b3d3b9db79937827/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f68746d6c2e74656d706c6174652e74656d706c617465696e746572666163652f762f756e737461626c65)](https://packagist.org/packages/mouf/html.template.templateinterface)[![License](https://camo.githubusercontent.com/717658271fc8658849b3c0e3456bf130e199a15cb92f427ce1b0d7b1798aecc9/68747470733a2f2f706f7365722e707567782e6f72672f6d6f75662f68746d6c2e74656d706c6174652e74656d706c617465696e746572666163652f6c6963656e7365)](https://packagist.org/packages/mouf/html.template.templateinterface)[![Build Status](https://camo.githubusercontent.com/c83e3ec988083a9c14f051f63f7f7d8b0f20dc8f1ec12b4ee0a3d7b05ecca557/68747470733a2f2f7472617669732d63692e6f72672f746865636f64696e676d616368696e652f68746d6c2e74656d706c6174652e74656d706c617465696e746572666163652e7376673f6272616e63683d332e30)](https://travis-ci.org/thecodingmachine/html.template.templateinterface)[![Coverage Status](https://camo.githubusercontent.com/d34fdee94a254021a29f94257a1288ef1c556b5071bac8568fd077f18730fc4b/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f746865636f64696e676d616368696e652f68746d6c2e74656d706c6174652e74656d706c617465696e746572666163652f62616467652e7376673f6272616e63683d332e3026736572766963653d676974687562)](https://coveralls.io/github/thecodingmachine/html.template.templateinterface?branch=3.0)

TemplateInterface: a base interface to manage HTML templates in your project
============================================================================

[](#templateinterface-a-base-interface-to-manage-html-templates-in-your-project)

TemplateInterface is a [Mouf package](http://mouf-php.com) that is the base building block of all HTML templates in Mouf.

You can use it without Mouf, but most of the time, you will use Mouf and its install process to get quickly started. Also, most of the time, you will not use the TemplateInterface package directly. Instead, you will use a Mouf template that is built using the TemplateInterface.

When you use a template object that implements TemplateInterface, you know this:

- The object has a "toHtml" method that will trigger the HTML output of the template. Call this method, and your template is displayed.
- The object has a "setTitle" method to set the title of the page.
- The object has a "getWebLibraryManager" method that returns a [web library manager](https://github.com/thecodingmachine/html.utils.weblibrarymanager). The WebLibraryManager can be used to add JS/CSS files to your template.

Depending on the template you will use, there will be one or more zones (main content, left menu, header, etc...) This is *template specific*. If you use Mouf, each zone of the template will be represented by a HtmlBlock object. You will directly access this block to add content in it.

Here is a sample pseudo code:

```
// Let's access the "content" block:
Mouf::getContent()->addText("Hello world!");

// Let's write the template:
Mouf::getTemplate()->toHtml();
```

Internally, the template uses the "content" block, but you should not care about it.

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity33

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 95.8% 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 ~717 days

Recently: every ~830 days

Total

6

Last Release

1310d ago

Major Versions

v2.1.1 → 3.0.x-dev2022-12-01

PHP version history (2 changes)2.0.x-devPHP &gt;=5.3.0

3.0.x-devPHP ^8.0

### 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 (23 commits)")[![homersimpsons](https://avatars.githubusercontent.com/u/16977446?v=4)](https://github.com/homersimpsons "homersimpsons (1 commits)")

---

Tags

interfacetemplatetemplateinterface

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[phpoffice/phpword

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

7.6k39.0M235](/packages/phpoffice-phpword)[rize/uri-template

PHP URI Template (RFC 6570) supports both expansion &amp; extraction

435149.5M63](/packages/rize-uri-template)[larablocks/pigeon

A more flexible email message builder for Laravel 5 including chained methods, reusable message configurations, and message layout and template view management.

143.7k](/packages/larablocks-pigeon)

PHPackages © 2026

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