PHPackages                             panakour/phpdom - 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. panakour/phpdom

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

panakour/phpdom
===============

Some helpers around PHP DOM native classes

v0.0.1(2y ago)02271MITPHPPHP &gt;=8.1

Since Dec 18Pushed 2y ago1 watchersCompare

[ Source](https://github.com/panakour/phpdom)[ Packagist](https://packagist.org/packages/panakour/phpdom)[ RSS](/packages/panakour-phpdom/feed)WikiDiscussions main Synced today

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

[![ci](https://github.com/panakour/phpdom/actions/workflows/ci.yml/badge.svg)](https://github.com/panakour/phpdom/actions/workflows/ci.yml)[![Code Coverage Badge](https://raw.githubusercontent.com/panakour/phpdom/image-data/coverage.svg)](https://raw.githubusercontent.com/panakour/phpdom/image-data/coverage.svg)

Panakour DOM
============

[](#panakour-dom)

This is a PHP package that provides a simple and intuitive API for manipulating DOM elements.

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

[](#installation)

You can install the package via composer:

```
composer require panakour/phpdom
```

Usage
-----

[](#usage)

First, you need to create a new instance of the `Dom` class:

```
$dom = new Dom('Hello, World!');
```

### Getting a list of nodes

[](#getting-a-list-of-nodes)

You can get a list of nodes with a specific tag name using the getNodeList method:

```
$images = $dom->getNodeList('img');
```

This will return a DOMNodeList containing all img elements in the document.

### Getting attribute values

[](#getting-attribute-values)

You can get the values of a specific attribute for all nodes with a specific tag name using the getAttributesValue method:

```
$imgSrc = $dom->getAttributesValue('img', 'src');
```

### Replacing attributes

[](#replacing-attributes)

You can replace the attributes of all nodes with a specific tag name using the replaceAttributes method:

```
$dom->replaceAttributes('img', [
    ['src' => 'new-src.jpg', 'alt' => 'New image']
]);
```

This will replace the src and alt attributes of all img elements in the document.

### Removing elements

[](#removing-elements)

You can remove all nodes with a specific tag name using the removeElementsAndItsContent method:

```
$dom->removeElementsAndItsContent(['img']);
```

This will remove all img elements from the document.

### Explore More

[](#explore-more)

Explore additional features and use cases in the unit tests found in /tests/DomTest.php.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

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

928d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6680ff78b32fb6b99cd57ea2fdc49b5d5e449c0f9991aae0a15285ccf17fc1f4?d=identicon)[panakour](/maintainers/panakour)

---

Top Contributors

[![panakour](https://avatars.githubusercontent.com/u/12927166?v=4)](https://github.com/panakour "panakour (6 commits)")

---

Tags

phpdomphpdom

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Type Coverage Yes

### Embed Badge

![Health badge](/badges/panakour-phpdom/health.svg)

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

###  Alternatives

[imanghafoori/laravel-anypass

A minimal yet powerful package to help you in development.

21623.4k](/packages/imanghafoori-laravel-anypass)

PHPackages © 2026

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