PHPackages                             pecee/boolean-query-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. [Database &amp; ORM](/categories/database)
4. /
5. pecee/boolean-query-parser

ActiveLibrary[Database &amp; ORM](/categories/database)

pecee/boolean-query-parser
==========================

Convert a boolean search query into a query that is compatible with a fulltext search.

1.0.3(8y ago)624.2k↓33.3%2MITPHPPHP &gt;=7.1

Since Mar 13Pushed 6y ago3 watchersCompare

[ Source](https://github.com/skipperbent/pecee-boolean-query-parser)[ Packagist](https://packagist.org/packages/pecee/boolean-query-parser)[ Docs](https://github.com/skipperbent/boolean-query-parser)[ RSS](/packages/pecee-boolean-query-parser/feed)WikiDiscussions v1-release Synced 1mo ago

READMEChangelog (4)Dependencies (2)Versions (6)Used By (0)

pecee/boolean-query-parser
==========================

[](#peceeboolean-query-parser)

Convert a boolean search query into a query that is compatible with a fulltext search.

### Notes

[](#notes)

This library is a maintained fork of the original project "BooleanSearchParser" created by DuncanOglethat, [available here](https://github.com/DuncanOgle/BooleanSearchParser).

The goal of this project is to iron out bugs, optimise the code, add new features and make it compatible with future versions of PHP.

Requirements
------------

[](#requirements)

- PHP 7.1 or higher

### Installation

[](#installation)

```
composer require pecee/boolean-query-parser

```

### Parsing a query

[](#parsing-a-query)

```
$parser = new \Pecee\BooleanQueryParser\BooleanQueryParser();

$formattedQuery = $parser->parse('ict OR (technology AND bob)');
```

**Output**

```
ict (+technology +bob)

```

### Order

[](#order)

Order and brackets are important, more often than not OR logic takes priority

`sales OR finance AND manager` will become `sales finance +manager` and not `sales +finance +manager`

Examples
--------

[](#examples)

InputOutput`ict``+ict``ict it``+ict +it``ict OR it``ict it``NOT ict``-ict``it NOT ict``+it -ict``web AND (ict OR it)``+web +(ict it)``ict OR (it AND web)``ict (+it +web)``ict NOT (ict AND it AND web)``+ict -(+ict +it +web)``php OR (NOT web NOT embedded ict OR it)``php (-web -embedded ict it)``(web OR embedded) (ict OR it)``+(web embedded) +(ict it)``develop AND (web OR (ict AND php))``+develop +(web (+ict +php))``"ict``null ``"ict OR it"``+"ict OR it"`Advanced examples
-----------------

[](#advanced-examples)

InputOutput`"business development" or "it sales" and (danish or dutch or italian or denmark or holland or netherlands or italy)``"business development" "it sales" +(danish dutch italian denmark holland netherlands italy)``(procurement or buying or purchasing) and (marine or sea) and (engineering or engineer)``+(procurement buying purchasing) +(marine sea) +(engineering engineer)`Licence
-------

[](#licence)

Licensed under the MIT licence.

### The MIT License (MIT)

[](#the-mit-license-mit)

Copyright (c) 2018 Simon Sessingø / pecee-boolean-query-parser

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

35

—

LowBetter than 80% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity62

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 ~1 days

Total

4

Last Release

2985d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2dab716ac4ac16ea3e01400efe43853b43821b33b8c601c2c772689d58cebf3c?d=identicon)[sessingo](/maintainers/sessingo)

---

Top Contributors

[![skipperbent](https://avatars.githubusercontent.com/u/634762?v=4)](https://github.com/skipperbent "skipperbent (7 commits)")

---

Tags

boolean-queryboolean-query-formatterboolean-query-parserdatabasefulltext-querymysql-fulltext-querymysql-query-parserparserdatabasemysqlquery parserboolean search parserboolean query parserboolean query formattermysql fulltext formatterquery formatterfulltext query format

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pecee-boolean-query-parser/health.svg)

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

###  Alternatives

[rah/danpu

Zero-dependency MySQL dump library for easily exporting and importing databases

64401.8k10](/packages/rah-danpu)

PHPackages © 2026

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