Skip to content
📜 Modern Simple HTML DOM Parser for PHP
Branch: master
Clone or download
Pull request Compare This branch is 289 commits ahead, 17 commits behind samacs:master.
Latest commit d45b974 Jul 19, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
.github [*]: add github config files May 26, 2019
example Update example_modify_contents.php Aug 3, 2017
src/voku/helper [+]: check result of "html5FallbackForScriptTags()" Jul 18, 2019
tests [+]: add "XmlParser" + simple tests v2 Jul 1, 2019
.editorconfig [+]: added ".editorconfig" & ".styleci.yml" Aug 19, 2015
.gitattributes [+]: use phpcs fixer Dec 20, 2018
.gitignore [+]: use phpcs fixer Dec 20, 2018
.styleci.yml [*]: "Text files should end with a newline character" Sep 22, 2016
.travis.yml [~]: use interfaces as return types Apr 25, 2019
CHANGELOG [*]: update the changelog Jul 1, 2019
LICENSE Create LICENSE Sep 25, 2016 Update Mar 31, 2019
composer.json Update phpunit/phpunit requirement from ~6.0 to ~6.0 || ~7.0 Dec 25, 2018
phpcs.php_cs [~]: use interfaces as return types Apr 25, 2019
phpstan.neon [+]: add "XmlParser" + simple tests v2 Jul 1, 2019
phpunit.xml [*]: update phpunit-config Dec 1, 2017

Build Status Coverage Status Codacy Badge Latest Stable Version Total Downloads License Donate to this project using Paypal Donate to this project using Patreon

📜 Simple Html Dom Parser for PHP

A HTML DOM parser written in PHP - let you manipulate HTML in a very easy way! This is a fork of PHP Simple HTML DOM Parser project but instead of string manipulation we use DOMDocument and modern php classes like "Symfony CssSelector".

  • PHP 7.0+ Support
  • PHP-FIG Standard
  • Composer & PSR-4 support
  • PHPUnit testing via Travis CI
  • PHP-Quality testing via SensioLabsInsight
  • UTF-8 Support (more support via "voku/portable-utf8")
  • Invalid HTML Support (partly ...)
  • Find tags on an HTML page with selectors just like jQuery
  • Extract contents from HTML in a single line

Install via "composer require"

composer require voku/simple_html_dom
composer require voku/portable-utf8 # if you need e.g. UTF-8 fixed output

Quick Start

use voku\helper\HtmlDomParser;

require_once 'composer/autoload.php';

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

$element = $dom->findOne('#css-selector'); // "$element" === instance of "SimpleHtmlDom"

$elements = $dom->findMulti('.css-selector'); // "$elements" === instance of SimpleHtmlDomNodeInterface<int, SimpleHtmlDom>



For support and donations please visit Github | Issues | PayPal | Patreon.

For status updates and release announcements please visit Releases | Twitter | Patreon.

For professional support please contact me.


  • Thanks to GitHub (Microsoft) for hosting the code and a good infrastructure including Issues-Managment, etc.
  • Thanks to IntelliJ as they make the best IDEs for PHP and they gave me an open source license for PhpStorm!
  • Thanks to Travis CI for being the most awesome, easiest continous integration tool out there!
  • Thanks to StyleCI for the simple but powerfull code style check.
  • Thanks to PHPStan && Psalm for relly great Static analysis tools and for discover bugs in the code!


FOSSA Status

You can’t perform that action at this time.