andig / php-html-parser
Refactored repack of https://github.com/hkk12369/php-html-parser
Installs: 7 753
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 6
pkg:composer/andig/php-html-parser
Requires
- php: >=5.3
Requires (Dev)
- phpunit/phpunit: 3.7.*
This package is auto-updated.
Last update: 2025-09-25 10:16:48 UTC
README
A simple and efficient DOMDocument based PHP HTML and XML Parser. It accepts both css selector and xpath queries to search the document and handles malformed HTML as well.
Example:
$html = HtmlParser::from_string('<div id="outer"><span class="red">Some Text</span></div>'); $text = $html->find('#outer .red', 0)->text; echo $text; // outputs "Some Text"
Authors
Originally source code taken from https://github.com/hkk12369/php-html-parser. Test cases and refactoring for composer/packagist by https://github.com/andig/php-html-parser.
Installation via Composer
Define the following requirement in your composer.json file:
{ "require": { "andig/php-html-parser": "dev-master" } }