voku / simple_html_dom
Simple HTML DOM package.
Fund package maintenance!
voku
Patreon
Tidelift
www.paypal.me/moelleken
Installs: 5 695 526
Dependents: 54
Suggesters: 0
Security: 0
Stars: 866
Watchers: 20
Forks: 545
Open Issues: 20
Requires
- php: >=7.0.0
- ext-dom: *
- ext-libxml: *
- ext-simplexml: *
- symfony/css-selector: ~3.0 || ~4.0 || ~5.0 || ~6.0 || ~7.0
Requires (Dev)
- phpunit/phpunit: ~6.0 || ~7.0 || ~9.0
Suggests
- voku/portable-utf8: If you need e.g. UTF-8 fixed output.
- dev-master
- 4.8.10
- 4.8.9
- 4.8.8
- 4.8.7
- 4.8.6
- 4.8.5
- 4.8.4
- 4.8.3
- 4.8.2
- 4.8.1
- 4.8.0
- 4.7.31
- 4.7.30
- 4.7.29
- 4.7.28
- 4.7.27
- 4.7.26
- 4.7.25
- 4.7.24
- 4.7.23
- 4.7.22
- 4.7.21
- 4.7.20
- 4.7.19
- 4.7.18
- 4.7.17
- 4.7.16
- 4.7.15
- 4.7.14
- 4.7.13
- 4.7.12
- 4.7.11
- 4.7.10
- 4.7.9
- 4.7.8
- 4.7.7
- 4.7.6
- 4.7.5
- 4.7.4
- 4.7.3
- 4.7.2
- 4.7.1
- 4.7.0
- 4.6.1
- 4.6.0
- 4.5.4
- 4.5.3
- 4.5.2
- 4.5.1
- 4.5.0
- 4.4.0
- 4.3.3
- 4.3.2
- 4.3.1
- 4.3.0
- 4.2.1
- 4.2.0
- 4.1.10
- 4.1.9
- 4.1.8
- 4.1.7
- 4.1.6
- 4.1.5
- 4.1.4
- 4.1.3
- 4.1.2
- 4.1.1
- 4.1.0
- 4.0.1
- 4.0.0
- 3.1.2
- 3.1.1
- 3.1.0
- 3.0.1
- 3.0.0
- 2.0.31
- 2.0.30
- 2.0.29
- 2.0.28
- 2.0.27
- 2.0.26
- 2.0.25
- 2.0.24
- 2.0.23
- 2.0.22
- 2.0.21
- 2.0.20
- 2.0.19
- 2.0.18
- 2.0.17
- 2.0.16
- 2.0.15
- 2.0.14
- 2.0.13
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2-RC
- 2.0.1-RC
- 2.0.0-RC
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.8
- 1.6.7
- 1.6.6
- 1.6.5
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0.2
- 1.6.0.1
- 1.6.0
- 1.5
- dev-analysis-g6g33E
- dev-analysis-LZ0egm
- dev-analysis-D2wpmJ
- dev-analysis-Yjn2bG
- dev-analysis-OMa5KW
- dev-dependabot/add-v2-config-file
- dev-use_ivopetkov_html5_dom
This package is auto-updated.
Last update: 2024-12-06 08:16:04 UTC
README
📜 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+ & 8.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 "SimpleHtmlDomInterface" $elements = $dom->findMulti('.css-selector'); // "$elements" === instance of SimpleHtmlDomNodeInterface<int, SimpleHtmlDomInterface> $elementOrFalse = $dom->findOneOrFalse('#css-selector'); // "$elementOrFalse" === instance of "SimpleHtmlDomInterface" or false $elementsOrFalse = $dom->findMultiOrFalse('.css-selector'); // "$elementsOrFalse" === instance of SimpleHtmlDomNodeInterface<int, SimpleHtmlDomInterface> or false ...
Examples
github.com/voku/simple_html_dom/tree/master/example
API
github.com/voku/simple_html_dom/tree/master/README_API.md
Support
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
- 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!