PHPackages                             jclyons52/php-query - 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. jclyons52/php-query

ActiveLibrary

jclyons52/php-query
===================

jQuery / javascript api for html document manipulation in php

1.3.2(9y ago)16872MITPHPPHP ~5.5|~7.0

Since Apr 12Pushed 9y ago2 watchersCompare

[ Source](https://github.com/jclyons52/php-query)[ Packagist](https://packagist.org/packages/jclyons52/php-query)[ Docs](https://github.com/Jclyons52/PHPQuery)[ RSS](/packages/jclyons52-php-query/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (3)Versions (8)Used By (2)

PHPQuery
========

[](#phpquery)

[![Latest Version on Packagist](https://camo.githubusercontent.com/ccf4e3c8d5e0c8b560764059bd62b1a0ce107ce6156ef791b134719e0d73483b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a636c796f6e7335322f7068702d71756572792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jclyons52/php-query)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/0b737499337dcd0c2fd2bbed629fe97074ae5a8170df097e60471513450b712c/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a636c796f6e7335322f7068702d71756572792f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/jclyons52/php-query)[![Coverage Status](https://camo.githubusercontent.com/fec84cbe9cd6154bb9d257aad182a9a4e9a543b246c434ba412abeaece958838/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f6a636c796f6e7335322f50485051756572792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/jclyons52/PHPQuery/code-structure)[![Quality Score](https://camo.githubusercontent.com/ef44d1a2d3e86994ebf02c9009bcd26830724c65b328be2ac973ce913efe0a21/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6a636c796f6e7335322f50485051756572792e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/jclyons52/PHPQuery)[![Total Downloads](https://camo.githubusercontent.com/f5bbb3bb59004a94a4faf0181a007bca0213500706adcba320daab354e77520e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a636c796f6e7335322f7068702d71756572792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jclyons52/php-query)

Nobody really wants to do imperative dom manipulation on the back end, but sometimes you have to. Given that you've probably done a lot of dom manipulation in javascript, maybe it would be nice to use the same api on the back end. Use cases for this project include:

- DOM Crawlers
- Integration testing
- [Link previews](https://github.com/jclyons52/page-preview)

Install
-------

[](#install)

Via Composer

```
composer require jclyons52/php-query
```

Usage
-----

[](#usage)

```
$html =
             First Div
             Second Div
             Third Div
        ';

$dom = new Jclyons52\PHPQuery\Document($html);

$elements = $dom->querySelector('.col-sm-3');

$element->attr('styles', 'display: block;');

echo $element->attr('styles'); // 'display: block'

echo $element->text(); // 'First Div'

echo $element->hasClass('col-sm-3); // true

$element->css(); // ["color" => "blue", "display" => "none"];

$div3 = $dom->querySelectorAll('.col-sm-3')[2];

$div3->data(); // ["last-value" => 43, "hidden" => true, "options" => '{"name":"John"}']

echo $element->toString(); // ' First Div '
```

Change log
----------

[](#change-log)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) and [CONDUCT](CONDUCT.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Joseph Lyons](https://github.com/jclyons52)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

30

—

LowBetter than 65% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~32 days

Recently: every ~46 days

Total

7

Last Release

3485d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/85b74f34a674bb16966f6c18b88495685052a42743a85cfac4341b6790bf2762?d=identicon)[jclyons52](/maintainers/jclyons52)

---

Top Contributors

[![jclyons52](https://avatars.githubusercontent.com/u/6395559?v=4)](https://github.com/jclyons52 "jclyons52 (41 commits)")

---

Tags

phpQueryJclyons52

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/jclyons52-php-query/health.svg)

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

###  Alternatives

[jaeger/querylist

Simple, elegant, extensible PHP Web Scraper (crawler/spider),Use the css3 dom selector,Based on phpQuery! 简洁、优雅、可扩展的PHP采集工具(爬虫)，基于phpQuery。

2.7k641.7k86](/packages/jaeger-querylist)

PHPackages © 2026

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