PHPackages                             mathsgod/p-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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. mathsgod/p-query

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

mathsgod/p-query
================

Using jQuery liked method to parse html by using php

3.4.0(2y ago)0203[1 PRs](https://github.com/mathsgod/p-query/pulls)4MITPHPPHP ^8.0CI passing

Since Mar 12Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/mathsgod/p-query)[ Packagist](https://packagist.org/packages/mathsgod/p-query)[ RSS](/packages/mathsgod-p-query/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (49)Used By (4)

[![LICENSE](https://camo.githubusercontent.com/d5fc85c6fe6e1e7001761f04d4744c3d0dde43e073981921e92282b9964bad97/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d61746873676f642f702d7175657279)](https://camo.githubusercontent.com/d5fc85c6fe6e1e7001761f04d4744c3d0dde43e073981921e92282b9964bad97/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d61746873676f642f702d7175657279)

[![PHP Composer](https://github.com/mathsgod/p-query/workflows/PHP%20Composer/badge.svg)](https://github.com/mathsgod/p-query/workflows/PHP%20Composer/badge.svg)

Introduction
------------

[](#introduction)

PQuery is a PHP library used to control html string by using jQuery liked method.

Example
-------

[](#example)

```
require_once("vendor/autoload.php");

$p = p('
    Hello
');

$p->find(".hello")->text("abc");

echo $p; /*output

    abc

*/
```

PQuery supported method
-----------------------

[](#pquery-supported-method)

- size
- last
- first
- html
- prepend
- prependTo
- appendTo
- append
- attr
- after
- before
- css
- closest
- data
- addClass
- text
- contents
- children
- find
- remove
- removeAtt
- removeClass
- replaceWith
- required
- each
- val
- filter
- parent
- warp
- warpInner
- toggleClass
- hasClass
- prev
- next
- index

HTML element style and class
----------------------------

[](#html-element-style-and-class)

```
$div = new HTMLDivElement();
$div->classList->add("container");
$div->innerText = "Hello world!";
$div->style->color = "red";

echo $div; //Hello world!
```

Element.append
--------------

[](#elementappend)

### Append an element

[](#append-an-element)

```
$div=new HTMLDivElement();
$p=new HTMLParagraphElement();
$div->append($p);

echo $div; //
```

### Appending text

[](#appending-text)

```
$div=new HTMLDivElement();
$div->append("Some text");

echo $div; // Some text
```

### Appending an element and text

[](#appending-an-element-and-text)

```
$div=new HTMLDivElement();
$p=new HTMLParagraphElement();
$div->append("Some text",$p);

echo $div; // Some text
```

---

created by Raymond Chong

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance53

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.5% 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 ~49 days

Recently: every ~233 days

Total

47

Last Release

733d ago

Major Versions

1.1.15 → 2.0.02019-03-27

1.x-dev → 2.2.22020-06-19

2.4.0 → 3.0.02021-06-25

PHP version history (6 changes)1.1.0PHP &gt;=5.4

2.0.5PHP &gt;=5.6

2.1.0PHP &gt;=7.1

2.0.13PHP &gt;=7.0

1.2.0PHP &gt;=5.6 &lt;7.0

3.0.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/18732337?v=4)[Raymond](/maintainers/mathsgod)[@mathsgod](https://github.com/mathsgod)

---

Top Contributors

[![mathsgod](https://avatars.githubusercontent.com/u/18732337?v=4)](https://github.com/mathsgod "mathsgod (188 commits)")[![HostLinkUser](https://avatars.githubusercontent.com/u/23697872?v=4)](https://github.com/HostLinkUser "HostLinkUser (1 commits)")

---

Tags

domhtmlphpphp-library

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mathsgod-p-query/health.svg)

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

###  Alternatives

[voku/simple_html_dom

Simple HTML DOM package.

9188.3M63](/packages/voku-simple-html-dom)[scotteh/php-dom-wrapper

Simple DOM wrapper to select nodes using either CSS or XPath expressions and manipulate results quickly and easily.

1471.9M10](/packages/scotteh-php-dom-wrapper)[spekulatius/phpscraper

PHPScraper, built with simplicity in mind. See tests/ for more examples.

583143.5k3](/packages/spekulatius-phpscraper)[dimabdc/php-fast-simple-html-dom-parser

PHP Fast Simple HTML DOM parser.

9352.6k](/packages/dimabdc-php-fast-simple-html-dom-parser)[xparse/element-finder

Elegant data scrapping

3445.0k2](/packages/xparse-element-finder)

PHPackages © 2026

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