PHPackages                             phpgt/cssxpath - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. phpgt/cssxpath

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

phpgt/cssxpath
==============

Convert CSS selectors to XPath queries.

v1.5.0(2mo ago)2512.3M—2.1%11[1 issues](https://github.com/PhpGt/CssXPath/issues)3MITPHPPHP &gt;=8.2CI passing

Since Aug 7Pushed 1mo ago2 watchersCompare

[ Source](https://github.com/PhpGt/CssXPath)[ Packagist](https://packagist.org/packages/phpgt/cssxpath)[ GitHub Sponsors](https://github.com/sponsors/PhpGt)[ RSS](/packages/phpgt-cssxpath/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (23)Used By (3)

Translate CSS selectors to XPath queries.
=========================================

[](#translate-css-selectors-to-xpath-queries)

A lightweight and dependency free CSS to XPath translator. This repository is used to bring modern DOM functionality like [`querySelectorAll()`](https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll) to PHP in the [PHP.Gt/Dom](https://www.php.gt/dom) project.

---

[ ![Build status](https://camo.githubusercontent.com/1d987966d0e99364024a25a8e561791ae278fe53a659a842c503c379906bb19a/68747470733a2f2f62616467652e7374617475732e7068702e67742f63737378706174682d6275696c642e737667)](https://github.com/PhpGt/CssXPath/actions)[ ![Code quality](https://camo.githubusercontent.com/f78ee1879edff0701175a647602108a263c008f805691bf56beba613a925d492/68747470733a2f2f62616467652e7374617475732e7068702e67742f63737378706174682d7175616c6974792e737667)](https://app.codacy.com/gh/PhpGt/CssXPath)[ ![Code coverage](https://camo.githubusercontent.com/0d4c45c2241954cda55ff14edd45128b8785b2550fea7c05c9518bfd68d639df/68747470733a2f2f62616467652e7374617475732e7068702e67742f63737378706174682d636f7665726167652e737667)](https://app.codecov.io/gh/PhpGt/CssXPath)[ ![Current version](https://camo.githubusercontent.com/b9a5291e90cd36e5a5925c6a822ea8147e90ea1dfc0536c3ea4dc6b13de5d07c/68747470733a2f2f62616467652e7374617475732e7068702e67742f63737378706174682d76657273696f6e2e737667)](https://packagist.org/packages/PhpGt/CssXPath)[ ![PHP.Gt/CssXPath documentation](https://camo.githubusercontent.com/739f4457ebadb35be5763fa3842e4a1491fbaab5cd84ed1c4f316b119e6cdc4d/68747470733a2f2f62616467652e7374617475732e7068702e67742f63737378706174682d646f63732e737667)](http://www.php.gt/cssxpath)Example usage
-------------

[](#example-usage)

```
use Gt\CssXPath\Translator;

$html =
