PHPackages                             vladshut/php-dom-wrapper - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. vladshut/php-dom-wrapper

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

vladshut/php-dom-wrapper
========================

Simple DOM wrapper to select nodes using either CSS or XPath expressions and manipulate results quickly and easily.

0.3.0(10y ago)022BSD-3-ClausePHPPHP &gt;=5.4.0

Since May 6Pushed 10y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (4)Used By (0)

\#PHP DOM Wrapper [![Scrutinizer Code Quality](https://camo.githubusercontent.com/cd4b6eeb370958ce472c7661a53d7de9c7a66b93c1235577feec88150673cdc1/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f73636f747465682f7068702d646f6d2d777261707065722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/scotteh/php-dom-wrapper/?branch=master) [![Build Status](https://camo.githubusercontent.com/8d1263997bc6efc0c5235a7430d96c0069977fbe7a97b10724b4efa31cd46379/68747470733a2f2f7472617669732d63692e6f72672f73636f747465682f7068702d646f6d2d777261707065722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/scotteh/php-dom-wrapper)

\##Intro

PHP DOM Wrapper is a simple DOM wrapper library to manipulate and traverse HTML documents. Based around jQuery's manipulation and traversal methods, largely mimicking the behaviour of it's jQuery counterparts.

\##Author

- Andrew Scott ()

\##Requirements

- PHP 5.4 or later
- PSR-4 compatible autoloader

\##Install

This library is designed to be installed via [Composer](https://getcomposer.org/doc/).

Add the dependency into your projects composer.json.

```
{
  "require": {
    "scotteh/php-dom-wrapper": "dev-master"
  }
}

```

Download the composer.phar

```
curl -sS https://getcomposer.org/installer | php
```

Install the library.

```
php composer.phar install
```

\##Autoloading

This library requires an autoloader, if you aren't already using one you can include [Composers autoloader](https://getcomposer.org/doc/01-basic-usage.md#autoloading).

```
require('vendor/autoload.php');
```

\##Methods

\###Manipulation

MethodImplementedaddClass**Yes**after**Yes**append**Yes**attr**Yes**before**Yes**clone**Yes**detach**Yes**empty**Yes**hasClass**Yes**html**Yes**prepend**Yes**remove**Yes**removeAttr**Yes**removeClass**Yes**replaceWith**Yes**text**Yes**unwrap**Yes**wrap**Yes**wrapAll**Yes**wrapInner**Yes**\###Traversal

MethodImplementedMethod Name *(if different)*add**Yes**children**Yes**closest**Yes**contents**Yes**eq**Yes**filter**Yes**find**Yes**first**Yes**has**Yes**is**Yes**last**Yes**map**Yes**next**Yes***following*nextAll**Yes***followingAll*nextUntil**Yes***followingUntil*not**Yes**parent**Yes**parents**Yes**parentsUntil**Yes**prev**Yes***preceding*prevAll**Yes***precedingAll*prevUntil**Yes***precedingUntil*siblings**Yes**slice**Yes**Additional Methods:

- count()
- each()

\##Usage

Example #1:

```
use DOMWrap\Document;

$html = 'FirstSecondThird';

$doc = new Document();
$doc->html($html);
$nodes = $doc->find('li');

// Returns '3'
var_dump($nodes->count());

// Append as a child node to each
$nodes->append('!');

// Returns: First!Second!Third!
var_dump($doc->saveHTML($doc));
```

\##Licensing

PHP DOM Wrapper is licensed by Andrew Scott under the BSD 3-Clause License, see the LICENSE file for more details.

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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 ~43 days

Total

3

Last Release

3935d ago

### Community

Maintainers

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

---

Tags

parsercsshtmldomwrapper

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/vladshut-php-dom-wrapper/health.svg)

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

###  Alternatives

[scotteh/php-dom-wrapper

Simple DOM wrapper to select nodes using either CSS or XPath expressions and manipulate results quickly and easily.

1471.9M10](/packages/scotteh-php-dom-wrapper)[masterminds/html5

An HTML5 parser and serializer.

1.8k242.8M226](/packages/masterminds-html5)[paquettg/php-html-parser

An HTML DOM parser. It allows you to manipulate HTML. Find tags on an HTML page with selectors just like jQuery.

2.4k7.9M121](/packages/paquettg-php-html-parser)[sunra/php-simple-html-dom-parser

Composer adaptation of: A HTML DOM parser written in PHP5+ let you manipulate HTML in a very easy way! Require PHP 5+. Supports invalid HTML. Find tags on an HTML page with selectors just like jQuery. Extract contents from HTML in a single line.

1.3k9.4M62](/packages/sunra-php-simple-html-dom-parser)[simplehtmldom/simplehtmldom

A fast, simple and reliable HTML document parser for PHP.

1921.3M14](/packages/simplehtmldom-simplehtmldom)[rct567/dom-query

DomQuery is a PHP library that allows easy 'jQuery like' DOM traversing and manipulation

134261.0k4](/packages/rct567-dom-query)

PHPackages © 2026

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