PHPackages                             xprt64/php-css - 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. xprt64/php-css

ActiveLibrary

xprt64/php-css
==============

Selects elements from a DOMDocument by a CSS selector

115PHP

Since Dec 18Pushed 10y ago1 watchersCompare

[ Source](https://github.com/xprt64/php-css)[ Packagist](https://packagist.org/packages/xprt64/php-css)[ RSS](/packages/xprt64-php-css/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

[PHP Css](#php-css)
===================

[](#php-css)

A PHP Library used to parse CSS and select elements from a DOMDocument

Contains code from [github.com/tj/php-selector](https://github.com/tj/php-selector) (the selector part)

- Composer enabled
- Contains PHPUnit tests

[Examples](#examples)
---------------------

[](#examples)

Given the folowing PHP code

```
$dom	=	new \DOMDocument();

$dom->loadHTML(getElementsByTagName('span')[0];

$span_styles = $parser->getStylesFromCssRules($span);
```

styles should contain 2 CSS styles:

```
font-weight:bold;
cursor: pointer;
```

\*

[Contribution](#contribution)
-----------------------------

[](#contribution)

\*

[More Information](#more-information)
-------------------------------------

[](#more-information)

- Is used with html to word (docx) converter: [github.com/xprt64/PHPWord](https://github.com/xprt64/PHPWord)

[License ](#license-)
---------------------

[](#license-)

(The MIT License)

Copyright © Constantin GALBENU &lt;xprt64@gmail.com&gt;

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/92b2d37c4ddbf95bf6dff48257ff2887f708b317f17f2607732f0a2b8ce359f3?d=identicon)[xprt64](/maintainers/xprt64)

---

Top Contributors

[![Darhazer](https://avatars.githubusercontent.com/u/679778?v=4)](https://github.com/Darhazer "Darhazer (15 commits)")[![tj](https://avatars.githubusercontent.com/u/25254?v=4)](https://github.com/tj "tj (14 commits)")[![xprt64](https://avatars.githubusercontent.com/u/915088?v=4)](https://github.com/xprt64 "xprt64 (11 commits)")[![Lcfvs](https://avatars.githubusercontent.com/u/2665124?v=4)](https://github.com/Lcfvs "Lcfvs (2 commits)")

### Embed Badge

![Health badge](/badges/xprt64-php-css/health.svg)

```
[![Health](https://phpackages.com/badges/xprt64-php-css/health.svg)](https://phpackages.com/packages/xprt64-php-css)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
