PHPackages                             phpbench/dom - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. phpbench/dom

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

phpbench/dom
============

DOM wrapper to simplify working with the PHP DOM implementation

0.3.3(3y ago)159.0M↓11.7%31MITPHPPHP ^7.3||^8.0

Since Nov 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/phpbench/dom)[ Packagist](https://packagist.org/packages/phpbench/dom)[ RSS](/packages/phpbench-dom/feed)WikiDiscussions master Synced 1mo ago

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

DOM
===

[](#dom)

**This library is abandoned**

[![CI](https://github.com/phpbench/dom/actions/workflows/ci.yaml/badge.svg)](https://github.com/phpbench/dom/actions/workflows/ci.yaml)

This library provides a wrapper for the PHP DOM library which makes your life easier.

It wraps the `\DOMDocument`, `\DOMElement` and `\DOMXpath` classes and throws *exceptions*.

Example:

```
$dom = new Document();
$element = $dom->createRoot('example');
$element->appendChild('boo', 'hello');
$element->appendChild('baz', 'world');

echo $dom->dump();
//
//
//   hello
//   world
//

$element->appendElement('number', 5);
$element->appendElement('number', 10);

echo $element->evaluate('sum(./number)'); // 15

$nodeList = $element->query('./number');

echo $nodeList->length; // 2
```

Document
--------

[](#document)

The `PhpBench\Dom\Document` class wraps the `\DOMDocument` class and replaces the `\DOMElement` class with the `PhpBench\Dom\Element` class.

It implements the `XPathAware` interface.

- `createRoot($name, $value = null)`: Create and return a new root node with `$name` and optional `$value`.
- `query($query, $context = null)`: Execute a given XPath query on the document.
- `queryOne($query, $context = null)`: Execute a given XPath query on the document and return the first element or `NULL`.
- `evaluate($query, $context = null)`: Evaluate the given XPath expression.
- `dump()`: Return a formatted string representation of the document.

Element
-------

[](#element)

Wraps the `\DOMElement` class and is used by default when you instantiate a `PhpBench\Dom\Document` class.

It implements the `XPathAware` interface.

- `appendElement($name $value)`: Create and return an element with name `$name` and value `$value`.
- `query`, `queryOne` and `evaluate`: As with Document but will use the context of this element by default.

###  Health Score

44

—

FairBetter than 92% of packages

Maintenance29

Infrequent updates — may be unmaintained

Popularity53

Moderate usage in the ecosystem

Community15

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 70% 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 ~531 days

Recently: every ~641 days

Total

6

Last Release

1169d ago

PHP version history (4 changes)0.1.0PHP ^5.4|^7.0

0.3.0PHP ^7.2|^8.0

0.3.1PHP ^7.2||^8.0

0.3.3PHP ^7.3||^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/24ec7d5d6b7ea54007be5d7b4f43800381cc1e22929f7d2276fba30e497fdfa6?d=identicon)[dantleech](/maintainers/dantleech)

---

Top Contributors

[![dantleech](https://avatars.githubusercontent.com/u/530801?v=4)](https://github.com/dantleech "dantleech (42 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (17 commits)")[![Crell](https://avatars.githubusercontent.com/u/254863?v=4)](https://github.com/Crell "Crell (1 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/phpbench-dom/health.svg)

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

###  Alternatives

[dantleech/gherkin-lint

Gherkin linter

46177.5k11](/packages/dantleech-gherkin-lint)[zhaohehe/laravel-echo-server

166.2k](/packages/zhaohehe-laravel-echo-server)

PHPackages © 2026

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