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

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

webforge/dom
============

A very very very very very simple aproach to build an api like jquery for html (testing) in php

1.0.1(12y ago)79833MITPHP

Since May 2Pushed 11y ago1 watchersCompare

[ Source](https://github.com/webforge-labs/webforge-dom)[ Packagist](https://packagist.org/packages/webforge/dom)[ RSS](/packages/webforge-dom/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (3)Versions (3)Used By (3)

webforge-dom
============

[](#webforge-dom)

A very very very very very simple aproach to build an api like jquery for html (testing) in php. It provides some helper for DOM\*\*\* Classes in PHP (that were difficult to debug before).

uses the symfony CSSSelector class

installation
------------

[](#installation)

Use [Composer](http://getcomposer.org) to install.

```
composer require -v --prefer-source webforge/dom:1.0.*

```

to run the tests use:

```
phpunit

```

usage
-----

[](#usage)

Lets say, we're operating on this html:

```
Please Login

    Bitte geben sie ein Passwort ein:

    Bitte best&auml;tigen sie das Passwort:

Reset your password
```

```
$hiddenInput = Query::create('form.main', $this->html)->find('input[name="submitted"]');

// returns an instanceof Query with the html:
```

```
$fieldsetUserData = Query::create('form.main', $this->html)->find('fieldset')->eq(0);
```

returns an instanceof Query with the html: `attr('href');
// 'http://www.ps-webforge.com'
```

works like the jquery `attr`

```
$innerHtml = Query::create('fieldset:first', $this->html)->html();

// ''
```

Returns the html from all children combined.

```
$html = Query::create('fieldset:first [name="email"]', $this->html)->outerHtml();

// ''
```

Returns the html from the element and all its children combined.

Note: The output from outerHtml() and html() is not exactly identical to the parts in the original html, because it is reformatted internally by the PHP-DOM functions.

```
$true = Query::create('fieldset:first', $this->html)->hasClass('user-data');
```

```
$true = Query::create('fieldset:first', $this->html)->hasClass('group');
```

```
$false = Query::create('fieldset:first', $this->html)->hasClass('user-data.group');
```

Checks if the element has a specific, single class.

issues
------

[](#issues)

- a selector like `something:eq(0)` does not exactly behave like it would be in jquery. Currently it is rewritten to :nth-of-type(0). But this is not exactly the same
- it's currently not possible to do a find() on a set of matched elements (PR welcome)
- hasClass does not work with combined classes like: `user-data.group`

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 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

Every ~3 days

Total

2

Last Release

4393d ago

### Community

Maintainers

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

---

Top Contributors

[![pscheit](https://avatars.githubusercontent.com/u/488189?v=4)](https://github.com/pscheit "pscheit (16 commits)")

### Embed Badge

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

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

###  Alternatives

[roach-php/core

A complete web scraping toolkit for PHP

1.5k352.4k3](/packages/roach-php-core)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[wa72/htmlpagedom

jQuery-inspired DOM manipulation extension for Symfony's Crawler

3383.9M34](/packages/wa72-htmlpagedom)[vdb/php-spider

A configurable and extensible PHP web spider

1.4k181.0k7](/packages/vdb-php-spider)[dominikb/composer-license-checker

Utility to check for licenses of dependencies and block/allow them.

563.8M9](/packages/dominikb-composer-license-checker)[dusterio/link-preview

Link preview generation for PHP with Laravel support

126326.6k3](/packages/dusterio-link-preview)

PHPackages © 2026

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