Installation
Install Search Syntax Parser with Composer, check its PHP requirements, and parse your first search query.
Install the package with Composer. It needs no framework configuration, service provider, or database.
Requirements
Search Syntax Parser requires PHP 8.4 or later with the mbstring extension.
Install the package
Install the package as a regular dependency:
bash
composer require hosmelq/search-syntax-parserFramework applications already load Composer's autoloader. In a standalone script, load it before using the parser:
php
require_once 'vendor/autoload.php';
use HosmelQ\SearchSyntaxParser\SearchParser;
$result = SearchParser::query('coffee')->build();The query returns:
php
[
'quoted' => false,
'type' => 'term',
'value' => 'coffee',
]Next steps
Read the query syntax, then choose the fields and value rules your application accepts.