magento / cssxpath
Convert CSS selectors to XPath queries.
v1.1.3
2020-02-24 19:28 UTC
Requires
- php: >=7.1
Conflicts
- phpgt/dom: *
This package is auto-updated.
Last update: 2024-11-15 05:53:33 UTC
README
A lightweight and dependency free CSS to XPath translator. This repository is used to bring modern DOM functionality like querySelectorAll()
to PHP in the PHP.Gt/Dom project.
Example usage
use Gt\CssXPath\Translator; $html = <<<HTML <form> <label> Name <input name="name" /> </label> <label> Code: <input name="code" /> </label> <button name="do" value="submit">Submit code</button> </form> HTML; $document = new DOMDocument(); $document->loadHTML($html); $xpath = new DOMXPath($document); $inputElementList = $xpath->query(new Translator("form>label>input");