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

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

gdbots/query-parser
===================

Php library that converts search queries into terms, phrases, hashtags, mentions, etc.

v3.0.0(4y ago)30162.0k↓26.4%17[1 issues](https://github.com/gdbots/query-parser-php/issues)2Apache-2.0PHPPHP &gt;=8.1CI failing

Since Jan 12Pushed 4y ago11 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (14)Used By (2)

query-parser-php
================

[](#query-parser-php)

[![Build Status](https://camo.githubusercontent.com/5524f439577ddb22006c4210ad3b97467b247508f7b008f201467191d6e00a72/68747470733a2f2f6170692e7472617669732d63692e6f72672f6764626f74732f71756572792d7061727365722d7068702e737667)](https://travis-ci.org/gdbots/query-parser-php)

Php library that converts search queries into words, phrases, hashtags, mentions, etc.

This library supports a simple search query standard. It is meant to support the most common search combinations that a user would likely enter into your website search box or dashboard application. It intentionally limits the more complex nested capabilities that you might expect from SQL builders, Lucene, etc.

Tokenizer
---------

[](#tokenizer)

Tokens are split on whitespace unless enclosed in double quotes. The following tokens are extracted by the `Tokenizer`:

```
class Token implements \JsonSerializable
{
    const T_EOI              = 0;  // end of input
    const T_WHITE_SPACE      = 1;
    const T_IGNORED          = 2;  // an ignored token, e.g. #, !, etc.  when found by themselves, don't do anything with them.
    const T_NUMBER           = 3;  // 10, 0.8, .64, 6.022e23
    const T_REQUIRED         = 4;  // '+'
    const T_PROHIBITED       = 5;  // '-'
    const T_GREATER_THAN     = 6;  // '>'
    const T_LESS_THAN        = 7;  // '
