Download the PHP package technically/search-query without Composer

On this page you can find all versions of the php package technically/search-query. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package search-query

Technically Search Query

🔍 Parse plaintext search queries into easy-to-use filter structures.

This library takes a human-typed search query string and parses it into a structured Query object containing typed filters (KeywordFilter, FieldFilter). It supports quoted strings, negation, comparison operators, and field-based filtering.

Test


Installation

Requirements:


Quick Start


Supported Query Syntax

Syntax Parsed As
hello KeywordFilter('hello')
"hello world" KeywordFilter('hello world', quoted: true)
-hello KeywordFilter('hello', exclude: true)
tag:php FieldFilter('tag', ':', 'php')
-tag:php FieldFilter('tag', ':', 'php', exclude: true)
year>2020 FieldFilter('year', '>', '2020')
year>=2020 FieldFilter('year', '>=', '2020')
year<2020 FieldFilter('year', '<', '2020')
year<=2020 FieldFilter('year', '<=', '2020')
hello\ world KeywordFilter('hello world') (escaped whitespace)
"custom field":value FieldFilter('custom field', ':', 'value')

Negation

A leading - (minus) before a keyword or field filter negates it. Multiple minuses are gracefully collapsed into a single negation.

Quoting

Double quotes group multiple words into a single token. Quotes can be escaped with \.

Escaping

The backslash \ escape character works both inside and outside quoted strings:

The Tolerant Reader

The parser is built using the Tolerant Reader design pattern — to be forgiving with malformed input. It never throws.


API Reference

QueryParser

The main entry point for parsing query strings.

The parser accepts an optional Tokenizer instance in its constructor. By default, it uses QueryTokenizer.

Methods


Query

An immutable value object representing the parsed search query.

Properties

Methods


Filters

All filters implement the Technically\SearchQuery\Filters\Filter marker interface.

KeywordFilter

Represents a free-text keyword search term.

Properties:

Methods:

FieldFilter

Represents a field-based filter (field:operator:value).

Properties:

Methods:


Examples

Parse a complex query

Serialize filters back to strings

Custom tokenization


Running Tests

Tests are written with Pest PHP.


License

MIT

Credits

Implemented by :space_invader: Ivan Voskoboinyk.


All versions of search-query with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package technically/search-query contains the following files

Loading the files please wait ...