PHPackages                             eyupcanakman/simple-html-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. eyupcanakman/simple-html-dom

ActiveLibrary

eyupcanakman/simple-html-dom
============================

A modern HTML DOM parser for PHP using DOMDocument and Symfony CssSelector.

v5.1.1(2mo ago)1353↓100%MITPHPPHP &gt;=7.1.0

Since Dec 7Pushed 2mo agoCompare

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

READMEChangelogDependencies (2)Versions (137)Used By (0)

Simple Html Dom Parser for PHP
==============================

[](#simple-html-dom-parser-for-php)

A HTML DOM parser written in PHP - let you manipulate HTML in a very easy way!

A modern fork of [PHP Simple HTML DOM Parser](http://simplehtmldom.sourceforge.net/). Instead of string manipulation, it uses DOMDocument and modern PHP classes like Symfony CssSelector.

What's different in this fork
-----------------------------

[](#whats-different-in-this-fork)

- PHP 8.4 support (nullable parameter deprecations fixed)
- Symfony 8.0 support
- Leading combinator selectors (`> span`, `+ div`, `~ p`) now work in `find()`
- `@property` annotations on abstract classes for better static analysis (Psalm, PHPStan)
- Minimum PHP version corrected to 7.1.0 (matches actual nullable type usage)
- `findOneOrNull()` for PHP 8.0+ nullsafe operator support (`?->`)
- `remove()` method (jQuery-style alias for `delete()`)
- `text()` no longer includes `` and `` content
- Fixed crash when calling `delete()` on detached/root nodes
- HTML output no longer adds extra linebreaks not in the original
- Compound `text` / `comment` selectors: `find('div text')`, `find('p > text')`, `find('div comment')`
- SVG data URLs inside `` tags no longer break parsing (unquoted `url()` fix)

Features
--------

[](#features)

- PHP 7.1+ &amp; 8.x support
- Composer &amp; PSR-4
- UTF-8 support
- Invalid HTML support (partly)
- Find tags on an HTML page with selectors just like jQuery
- Extract contents from HTML in a single line

Install
-------

[](#install)

```
composer require eyupcanakman/simple-html-dom
```

Quick Start
-----------

[](#quick-start)

```
use eyupcanakman\SimpleHtmlDom\HtmlDomParser;

$dom = HtmlDomParser::str_get_html($str);
// or
$dom = HtmlDomParser::file_get_html($file);

$element = $dom->findOne('#css-selector');
$elements = $dom->findMulti('.css-selector');
$elementOrFalse = $dom->findOneOrFalse('#css-selector');
$elementOrNull = $dom->findOneOrNull('#css-selector');
$elementsOrFalse = $dom->findMultiOrFalse('.css-selector');

// PHP 8.0+ nullsafe operator
$text = $dom->findOneOrNull('.maybe-missing')?->text();

// Find text nodes inside an element
$textNodes = $dom->find('div text');        // all descendant text nodes
$directText = $dom->find('p > text');       // direct child text nodes only
$comments = $dom->find('div comment');      // comment nodes inside div
```

Examples
--------

[](#examples)

[github.com/eyupcanakman/simple\_html\_dom/tree/master/example](https://github.com/eyupcanakman/simple_html_dom/tree/master/example)

API
---

[](#api)

[github.com/eyupcanakman/simple\_html\_dom/tree/master/README\_API.md](https://github.com/eyupcanakman/simple_html_dom/tree/master/README_API.md)

License
-------

[](#license)

MIT - see [LICENSE](LICENSE)

Credits
-------

[](#credits)

Based on [PHP Simple HTML DOM Parser](http://simplehtmldom.sourceforge.net/).

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance86

Actively maintained with recent releases

Popularity19

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity76

Established project with proven stability

 Bus Factor1

Top contributor holds 87.2% 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 ~32 days

Recently: every ~0 days

Total

126

Last Release

70d ago

Major Versions

1.7.2 → 2.0.0-RC2016-04-01

2.0.31 → 3.0.02017-03-17

3.1.2 → 4.0.02017-11-19

v4.9.0 → v5.0.02026-02-28

PHP version history (4 changes)1.5PHP &gt;=5.2.4

1.6.0PHP &gt;=5.3.2

4.0.0PHP &gt;=7.0.0

v4.8.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/40c1e68364fcfad49a629d56d0ed1579991a026636dc8c306db0f18dbee85199?d=identicon)[eyupcanakman](/maintainers/eyupcanakman)

---

Top Contributors

[![voku](https://avatars.githubusercontent.com/u/264695?v=4)](https://github.com/voku "voku (380 commits)")[![eyupcanakman](https://avatars.githubusercontent.com/u/1732357?v=4)](https://github.com/eyupcanakman "eyupcanakman (14 commits)")[![samacs](https://avatars.githubusercontent.com/u/48268?v=4)](https://github.com/samacs "samacs (8 commits)")[![marioquartz](https://avatars.githubusercontent.com/u/3995147?v=4)](https://github.com/marioquartz "marioquartz (8 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (4 commits)")[![hryvinskyi](https://avatars.githubusercontent.com/u/9294098?v=4)](https://github.com/hryvinskyi "hryvinskyi (3 commits)")[![devteam-emroc](https://avatars.githubusercontent.com/u/104580363?v=4)](https://github.com/devteam-emroc "devteam-emroc (3 commits)")[![all9lives](https://avatars.githubusercontent.com/u/1470953?v=4)](https://github.com/all9lives "all9lives (2 commits)")[![scrutinizer-auto-fixer](https://avatars.githubusercontent.com/u/6253494?v=4)](https://github.com/scrutinizer-auto-fixer "scrutinizer-auto-fixer (2 commits)")[![frugan-dev](https://avatars.githubusercontent.com/u/7957714?v=4)](https://github.com/frugan-dev "frugan-dev (1 commits)")[![GerB](https://avatars.githubusercontent.com/u/444545?v=4)](https://github.com/GerB "GerB (1 commits)")[![flavioheleno](https://avatars.githubusercontent.com/u/471860?v=4)](https://github.com/flavioheleno "flavioheleno (1 commits)")[![FabianMartin](https://avatars.githubusercontent.com/u/390297?v=4)](https://github.com/FabianMartin "FabianMartin (1 commits)")[![nlemoine](https://avatars.githubusercontent.com/u/2526939?v=4)](https://github.com/nlemoine "nlemoine (1 commits)")[![phpfui](https://avatars.githubusercontent.com/u/7434059?v=4)](https://github.com/phpfui "phpfui (1 commits)")[![RobertEcker](https://avatars.githubusercontent.com/u/6156052?v=4)](https://github.com/RobertEcker "RobertEcker (1 commits)")[![dora38](https://avatars.githubusercontent.com/u/13598459?v=4)](https://github.com/dora38 "dora38 (1 commits)")[![dependabot-support](https://avatars.githubusercontent.com/u/112581971?v=4)](https://github.com/dependabot-support "dependabot-support (1 commits)")[![DieterHolvoet](https://avatars.githubusercontent.com/u/3606531?v=4)](https://github.com/DieterHolvoet "DieterHolvoet (1 commits)")[![tpruvot](https://avatars.githubusercontent.com/u/145119?v=4)](https://github.com/tpruvot "tpruvot (1 commits)")

---

Tags

domHTML Parserphp dom

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/eyupcanakman-simple-html-dom/health.svg)

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

###  Alternatives

[voku/simple_html_dom

Simple HTML DOM package.

9188.3M63](/packages/voku-simple-html-dom)[wa72/htmlpagedom

jQuery-inspired DOM manipulation extension for Symfony's Crawler

3383.9M34](/packages/wa72-htmlpagedom)[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)[sinnbeck/laravel-dom-assertions

106250.5k8](/packages/sinnbeck-laravel-dom-assertions)[phpunit/phpunit-dom-assertions

DOM assertions for PHPUnit

29343.5k11](/packages/phpunit-phpunit-dom-assertions)[xparse/element-finder

Elegant data scrapping

3445.0k2](/packages/xparse-element-finder)

PHPackages © 2026

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