PHPackages                             room11/dom-utils - 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. room11/dom-utils

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

room11/dom-utils
================

Utility functions for the PHP DOM extension

v1.1.1(9y ago)23.3k↓100%2MITPHP

Since May 6Pushed 8y ago25 watchersCompare

[ Source](https://github.com/Room-11/DOMUtils)[ Packagist](https://packagist.org/packages/room11/dom-utils)[ RSS](/packages/room11-dom-utils/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (7)Used By (0)

DOM Utils
=========

[](#dom-utils)

Utility functions for the PHP DOM extension.

Required PHP Version
--------------------

[](#required-php-version)

- PHP 7.0+

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

[](#installation)

```
$ composer require room11/dom-utils
```

Usage
-----

[](#usage)

### default\_charset

[](#default_charset)

Gets and sets the default charset used by DOMUtils functions.

```
default_charset(string $charSet = ''): string
```

When the supplied `$charSet` is empty, just return the current value. When a new value is supplied, change the default and return the old one.

- `string $charSet` - The new default character set.

### domdocument\_load\_html

[](#domdocument_load_html)

Loads a HTML string into a DOMDocument object, with error handling and character set normalization.

```
domdocument_load_html(string $html, int $options = 0, string $charSet = ''): \DOMDocument
```

Loads a HTML string into a DOMDocument object, with error handling and character set normalization.

- `string $html` - The HTML string to load.
- `int $options` - A bit mask of LibXML options to use when loading the document.
- `string $charSet` - The character set to use when loading the document. Defaults to `default_charset()`.

Throws a `LibXMLFatalErrorException` when loading the document fails.

### domdocument\_process\_html\_docs

[](#domdocument_process_html_docs)

Processes a set of HTML strings into DOMDocument objects and invokes a callback for each one.

```
domdocument_process_html_docs($htmlStrings, callable $callback, int $options = 0, string $charSet = ''): \DOMDocument
```

A DOMDocument object will be passed to the first argument of the callback, and an array of LibXMLError objects for the document to the second. The third argument is a boolean which is true if the document could not be loaded. The callback may return boolean false to break the iteration. Any other return value will be ignored.

- `string[] $htmlStrings` - An iterable set of HTML strings to process.
- `callable(\DOMDocument, \LibXMLError[], bool) $callback` - The callback to invoke for each document.
- `int $options` - A bit mask of LibXML options to use when loading the documents.
- `string $charSet` - The character set to use when loading the documents. Defaults to `default_charset()`.

###  Health Score

34

—

LowBetter than 79% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 64.7% 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 ~33 days

Recently: every ~40 days

Total

6

Last Release

3440d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9db967c6005625e444a502fb830a30669b9fed53bfbc67e81a054508c0975a6b?d=identicon)[Danack](/maintainers/Danack)

---

Top Contributors

[![DaveRandom](https://avatars.githubusercontent.com/u/2396425?v=4)](https://github.com/DaveRandom "DaveRandom (11 commits)")[![kelunik](https://avatars.githubusercontent.com/u/2743004?v=4)](https://github.com/kelunik "kelunik (6 commits)")

### Embed Badge

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

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

###  Alternatives

[kartik-v/yii2-widget-colorinput

An enhanced Yii 2 widget encapsulating the HTML 5 color input (sub repo split from yii2-widgets)

324.8M8](/packages/kartik-v-yii2-widget-colorinput)[captainhook/plugin-composer

Composer-Plugin handling your git-hooks

201.9M147](/packages/captainhook-plugin-composer)[jxlwqq/star-rating

Star Rating extension for laravel-admin.

216.2k](/packages/jxlwqq-star-rating)

PHPackages © 2026

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