library search-query-composer
Tokenizer and composer for search query from user input.
risototh/search-query-composer
Tokenizer and composer for search query from user input.
- Monday, April 16, 2018
- by risototh
- Repository
- 1 Watchers
- 0 Stars
- 41 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 5 Versions
- 3 % Grown
Search Query Composer
This library is intended for use in cases, where you want to extend the search abilities of simple search input. It takes the input from user, and tries to interpret them as an expression.
For example, user enters something like a AND NOT (b OR c) and this library will tokenize this input and construct the valid SQL statement fragment like, (*1)
`field` LIKE '%a%'
AND NOT(
`field` LIKE '%b%'
OR
`field` LIKE '%c%'
)
Features
- PSR-4 autoloading compliant structure
- Supports operators AND, OR, NOT
- Supports subquery nesting
- Easy to use
Use
Basic usage is very simple:, (*2)
$userInput = 'a AND NOT (b OR c)';
$pdo = new \PDO('your pdo connection');
echo RisoToth\Database\SearchQuery::make($userInput, $pdo, '`field`');
dev-master
9999999-dev
Tokenizer and composer for search query from user input.
Sources
Download
BSD-3-Clause
The Requires
The Development Requires
by
Richard Toth
database
sql
php
search
1.1.0
1.1.0.0
Tokenizer and composer for search query from user input.
Sources
Download
BSD-3-Clause
The Requires
The Development Requires
by
Richard Toth
database
sql
php
search
1.0.2
1.0.2.0
Tokenizer and composer for search query from user input.
Sources
Download
BSD-3-Clause
The Requires
The Development Requires
by
Richard Toth
database
sql
php
search
1.0.1
1.0.1.0
Tokenizer and composer for search query from user input.
Sources
Download
BSD-3-Clause
The Requires
The Development Requires
by
Richard Toth
database
sql
php
search
1.0.0
1.0.0.0
Tokenizer and composer for search query from user input.
Sources
Download
BSD-3-Clause
The Requires
The Development Requires
by
Richard Toth
database
sql
php
search