tje3d / domparser
1.0.0
2017-04-09 13:29 UTC
This package is not auto-updated.
Last update: 2024-12-13 19:53:34 UTC
README
This is a simple DomParser which can parse invalid html too. Edited version of http://simplehtmldom.sourceforge.net/.
Installation
composer require tje3d/domparser
Examples
✔️ Parse a string
$dom = Tje3d\DomParser\DomParser::parse(file_get_contents('url'))
✔️ Query element
$dom->find('.elementClass') // All element's with this class
$dom->find('#myId', 0) // First element with this id
$dom->find('[name=user]')
✔️ Available Functions
innerText, innerHTML, html, getAllAttributes, getAttribute, attr, hasAttribute, parentNode, nextSibling, previousSibling, nodeName