PHPackages                             manychois/pompom - 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. manychois/pompom

ActiveLibrary

manychois/pompom
================

Modern PHP DOM-based HTML templating helpers for building reusable templates with PHP 8.5+.

v0.0.1(1mo ago)00MITPHPPHP &gt;=8.5CI passing

Since Apr 8Pushed 1mo agoCompare

[ Source](https://github.com/manychois/pompom)[ Packagist](https://packagist.org/packages/manychois/pompom)[ RSS](/packages/manychois-pompom/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

Pompom
======

[](#pompom)

**Pompom** is a PHP library for building HTML with a **component-based, DOM-first** workflow: you compose templates from PHP classes that yield `Dom\*` nodes, not from string assembly or a separate template language.

---

Get started
-----------

[](#get-started)

You will install the package and render one named component to a `Dom\HTMLDocument`, then print HTML. You need PHP 8.5+ with `ext-dom`.

### 1. Install

[](#1-install)

```
composer require manychois/pompom
```

### 2. Render a root component

[](#2-render-a-root-component)

Register a **component resolver** (here `Psr4ComponentResolver`) so a string name maps to a component class. Build an **engine**, call **`render`**, then serialize:

```
use Manychois\Pompom\Engine;
use Manychois\Pompom\Internal\Psr4ComponentResolver;

$resolver = new Psr4ComponentResolver([
    'MyApp\\Components' => __DIR__ . '/src/Components',
]);

$engine = new Engine($resolver);
$document = $engine->render('hello-page', ['name' => 'World']);

echo $document->saveHtml();
```

You should see HTML produced by your `hello-page` component (that class must exist at the path implied by your PSR-4 mapping).

---

How to …
--------

[](#how-to-)

### Run tests and quality checks in this repository

[](#run-tests-and-quality-checks-in-this-repository)

If `documentation/internal/` is missing, initialize the submodule:

```
git submodule update --init documentation/internal
```

Then:

```
composer install
composer test    # PHPUnit (with coverage)
composer phpstan # static analysis
composer phpcs   # style and docblocks
```

---

About Pompom
------------

[](#about-pompom)

Pompom is built around **PHP 8.5+** and the modern **`Dom\*` API** (`Dom\HTMLDocument`, `Dom\Element`, …), not the legacy `DOMDocument` stack. The goal is reusable, testable pieces that return real DOM trees.

**Resolution and rendering.** You map arbitrary component names (e.g. `hello-page`) to classes via a **component resolver**. The **engine** creates an **empty** `Dom\HTMLDocument`, instantiates the root component, and iterates **`render($props)`**. Constructor injection gives only shared dependencies such as the document and engine; **render-time data is always `$props`**, not the DI container.

**What components output.** Components **yield** mixed values (text, nodes, nested component references). A **content resolver** turns each chunk into `Dom\Node` instances and the engine appends them. The **root component** is responsible for the full document shape (``, ``, `` if you need a full page); the engine does not insert those for you.

**Composition.** Typical pieces include **`AbstractComponent`**, **`NodeUtility`** for element helpers, **`component()`** / **`ComponentBuilder`** for child components, and **children** / **named regions** for slot-like content.

**Why DOM-first.** Output stays structured and easy to assert in tests (`saveHtml()`, walking nodes) and avoids ad-hoc concatenation; optional **Prettier** can indent HTML for readability before serialization.

---

Reference
---------

[](#reference)

**Package**`manychois/pompom`**PHP**`>= 8.5`**Extensions**`ext-dom`SymbolRole`Engine`Builds an empty `Dom\HTMLDocument`, resolves the root component, consumes `render()` output.`ComponentResolverInterface`Maps a component name to a component class (e.g. `Psr4ComponentResolver`).`AbstractComponent`Base for components; `render()` / `getContent()` pipeline, `component()`, children and regions.`ContentResolverInterface`Turns mixed yielded content into `Dom\Node` for a given document.`Prettier`Optional in-place formatting before `saveHtml()`.Serialization uses `Dom\HTMLDocument` methods such as `saveHtml()` and `saveHtmlFile()`.

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance94

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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

Unknown

Total

1

Last Release

32d ago

### Community

Maintainers

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

---

Top Contributors

[![manychois](https://avatars.githubusercontent.com/u/3290769?v=4)](https://github.com/manychois "manychois (15 commits)")

---

Tags

domhtml5php8template-engine-html

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/manychois-pompom/health.svg)

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

###  Alternatives

[respect/validation

The most awesome validation engine ever created for PHP

5.9k37.4M381](/packages/respect-validation)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.4k37.3k](/packages/matomo-matomo)[zbateson/mail-mime-parser

MIME email message parser

53949.2M79](/packages/zbateson-mail-mime-parser)[phlak/directory-lister

PHP directory lister

2.5k1.4k](/packages/phlak-directory-lister)[infinum/eightshift-libs

WordPress libs developed by Eightshift team to use in modern WordPress.

63118.9k3](/packages/infinum-eightshift-libs)[rareloop/lumberjack-core

A powerful MVC framework for the modern WordPress developer. Write better, more expressive and easier to maintain code

42155.0k19](/packages/rareloop-lumberjack-core)

PHPackages © 2026

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