PHPackages                             engage/query-text-parser - 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. [Search &amp; Filtering](/categories/search)
4. /
5. engage/query-text-parser

ActiveLibrary[Search &amp; Filtering](/categories/search)

engage/query-text-parser
========================

The Query Text Parser library performs search query text parsing

96.0k3PHP

Since Feb 25Pushed 9y ago7 watchersCompare

[ Source](https://github.com/EngageDC/query-text-parser)[ Packagist](https://packagist.org/packages/engage/query-text-parser)[ RSS](/packages/engage-query-text-parser/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

[![Build Status](https://camo.githubusercontent.com/02dfad134adb12f5214a2446ee17bf146b6509b1431507fffe883abd9f7268c8/68747470733a2f2f7472617669732d63692e6f72672f456e6761676544432f71756572792d746578742d7061727365722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/EngageDC/query-text-parser)

Query Text Parser
=================

[](#query-text-parser)

The Query Text Parser library performs search query text parsing.

This allows you to write a search query in free form text and parse it into a machine-readable parsing tree.

The library is fully unit-tested.

Features
--------

[](#features)

- AND/OR operators
- Grouped queries using paranthesis -- i.e. `(Denver AND Boston) OR Miami`
- Multi-word search queries using quotes -- i.e. `"San Francisco" AND Chicago`

Example usage
-------------

[](#example-usage)

```
$parser = new Engage\QueryTextParser\Parser;
$result = $parser->parse('(Chicago AND Houston) OR Phoenix');
print_r($result);
```

### Output

[](#output)

```
Engage\QueryTextParser\Data\Group Object
(
    [type] => OR
    [children] => Array
        (
            [0] => Engage\QueryTextParser\Data\Group Object
                (
                    [type] => AND
                    [children] => Array
                        (
                            [0] => Engage\QueryTextParser\Data\Partial Object
                                (
                                    [text] => Chicago
                                    [negate] =>
                                )

                            [1] => Engage\QueryTextParser\Data\Partial Object
                                (
                                    [text] => Houston
                                    [negate] =>
                                )

                        )

                )

            [1] => Engage\QueryTextParser\Data\Partial Object
                (
                    [text] => Phoenix
                    [negate] =>
                )

        )

)

```

TODO
----

[](#todo)

- Support negating operator (i.e. *NOT*)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/220535?v=4)[Mathias Hansen](/maintainers/MiniCodeMonkey)[@MiniCodeMonkey](https://github.com/MiniCodeMonkey)

---

Top Contributors

[![MiniCodeMonkey](https://avatars.githubusercontent.com/u/220535?v=4)](https://github.com/MiniCodeMonkey "MiniCodeMonkey (5 commits)")

### Embed Badge

![Health badge](/badges/engage-query-text-parser/health.svg)

```
[![Health](https://phpackages.com/badges/engage-query-text-parser/health.svg)](https://phpackages.com/packages/engage-query-text-parser)
```

###  Alternatives

[awesome-nova/dependent-filter

Dependent filters for Laravel Nova

26193.1k](/packages/awesome-nova-dependent-filter)[algolia/php-dom-parser

A simple tool to turn DOM into Algolia search friendly record objects.

181.8k](/packages/algolia-php-dom-parser)

PHPackages © 2026

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