PHPackages                             php-platform/search-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. php-platform/search-query-parser

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

php-platform/search-query-parser
================================

a library to parse search query parameters from a rest request

v0.1.1(8y ago)0242Apache-2.0PHPPHP &gt;=5.4

Since Feb 7Pushed 8y ago1 watchersCompare

[ Source](https://github.com/PHPPlatform/search-query-parser)[ Packagist](https://packagist.org/packages/php-platform/search-query-parser)[ RSS](/packages/php-platform-search-query-parser/feed)WikiDiscussions master Synced 4d ago

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

A Library for parsing search query parameters
=============================================

[](#a-library-for-parsing-search-query-parameters)

[![Build Status](https://camo.githubusercontent.com/f8351885978f2fc7543e610cdd6d5d83400b99a9f31ff5da938f4dcec049478f/68747470733a2f2f7472617669732d63692e6f72672f504850506c6174666f726d2f7365617263682d71756572792d7061727365722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/PHPPlatform/search-query-parser)

When a Model from [php-platform/persist](https://github.com/PHPPlatform/persist) is exposed as REST Resource ([php-platform/restful](https://github.com/PHPPlatform/restful)), It is required that the REST End point to list all resources must support **filter** , **sort** and **pagination**

Models extending [php-platform/persist](https://github.com/PHPPlatform/persist) supports **filter** , **sort** and **pagination** through arguments to [PhpPlatform\\Persist\\Model::find($filters,$sort,$pagination,$where)](https://github.com/PHPPlatform/persist/blob/master/src/Persist/Model.php#L324) method

So this library parses query parameters from rest endpoint to method arguments required by `PhpPlatform\Persist\Model::find($filters,$sort,$pagination,$where)`

How to use
----------

[](#how-to-use)

```
$searchParams = PhpPlatform\SearchQueryParser\Parser::parse(PhpPlatform\RESTFul\HTTPRequest $request,string $modelClassName, array $excludeFromFullTextSearch);
```

#### where

[](#where)

- **$request** is the HTTPRequest object received in the rest service
- **$modelClassName** is the full name of the Model which is served as REST Resource
- **$excludeFromFullTextSearch** is the array of fields which needs to be excluded from performing full text search

#### returns

[](#returns)

An instance of `PhpPlatform\SearchQueryParser\FindParams`

Parse rules
-----------

[](#parse-rules)

Query ParamMethod ParameterFormatq$where`string` for full text search , a complex `$where` expression is formed matching all the `get` fields from the Model , excluding the once mentioned in `$excludeFromFullTextSearch`. *Auto Increment* fields are excluded by defaultf$filters`base64` encoded `json` string representing the `$filters` objects$sort`base64` encoded `json` string representing the `$sort` objectp$pagination`'-'`> Note 1 : This API throws `PhpPlatform\Errors\Exceptions\Http\_4XX\BadRequest` Exception if the query parameters are invalid Note 2 : All of the above query parameters are optional

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

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.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

3015d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/92306cd4ec1342daeba6fb633880eb9907cdd022874ae39be11ab7ae274171c7?d=identicon)[Raaghu](/maintainers/Raaghu)

---

Top Contributors

[![Raaghu](https://avatars.githubusercontent.com/u/8255650?v=4)](https://github.com/Raaghu "Raaghu (10 commits)")

---

Tags

filterpaginationphpphp-platformrest-apisort

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/php-platform-search-query-parser/health.svg)

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

###  Alternatives

[ruflin/elastica

Elasticsearch Client

2.3k50.4M203](/packages/ruflin-elastica)[opensearch-project/opensearch-php

PHP Client for OpenSearch

15024.3M65](/packages/opensearch-project-opensearch-php)[mailerlite/laravel-elasticsearch

An easy way to use the official PHP ElasticSearch client in your Laravel applications.

934529.3k2](/packages/mailerlite-laravel-elasticsearch)[massive/search-bundle

Massive Search Bundle

721.4M13](/packages/massive-search-bundle)[shyim/opensearch-php-dsl

OpenSearch/Elasticsearch DSL library

175.9M9](/packages/shyim-opensearch-php-dsl)[outl1ne/nova-multiselect-filter

Multiselect filter for Laravel Nova.

45802.7k3](/packages/outl1ne-nova-multiselect-filter)

PHPackages © 2026

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