{"id":13623591,"url":"https://foolcode.github.io/SphinxQL-Query-Builder/","last_synced_at":"2025-04-15T14:33:36.801Z","repository":{"id":4337746,"uuid":"5473481","full_name":"FoolCode/SphinxQL-Query-Builder","owner":"FoolCode","description":"SphinxQL Query Builder generates SphinxQL, a SQL dialect, which is used to query the Sphinx search engine. (Composer Package)","archived":false,"fork":false,"pushed_at":"2023-06-28T08:02:49.000Z","size":815,"stargazers_count":326,"open_issues_count":24,"forks_count":95,"subscribers_count":29,"default_branch":"master","last_synced_at":"2024-11-07T16:04:47.281Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://foolcode.github.com/SphinxQL-Query-Builder/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FoolCode.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-08-19T19:10:52.000Z","updated_at":"2024-08-07T13:40:24.000Z","dependencies_parsed_at":"2023-07-05T18:32:14.042Z","dependency_job_id":null,"html_url":"https://github.com/FoolCode/SphinxQL-Query-Builder","commit_stats":{"total_commits":364,"total_committers":41,"mean_commits":8.878048780487806,"dds":0.7362637362637363,"last_synced_commit":"6c1b1b44c941989e39034a7b6a3f987e938cca7a"},"previous_names":[],"tags_count":40,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FoolCode%2FSphinxQL-Query-Builder","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FoolCode%2FSphinxQL-Query-Builder/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FoolCode%2FSphinxQL-Query-Builder/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FoolCode%2FSphinxQL-Query-Builder/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FoolCode","download_url":"https://codeload.github.com/FoolCode/SphinxQL-Query-Builder/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223677684,"owners_count":17184526,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T21:01:33.500Z","updated_at":"2024-11-08T11:31:06.865Z","avatar_url":"https://github.com/FoolCode.png","language":"PHP","readme":"Query Builder for SphinxQL\n==========================\n\n[![Build Status](https://travis-ci.org/FoolCode/SphinxQL-Query-Builder.png)](https://travis-ci.org/FoolCode/SphinxQL-Query-Builder)\n[![Latest Stable Version](https://poser.pugx.org/foolz/sphinxql-query-builder/v/stable)](https://packagist.org/packages/foolz/sphinxql-query-builder)\n[![Latest Unstable Version](https://poser.pugx.org/foolz/sphinxql-query-builder/v/unstable)](https://packagist.org/packages/foolz/sphinxql-query-builder)\n[![Total Downloads](https://poser.pugx.org/foolz/sphinxql-query-builder/downloads)](https://packagist.org/packages/foolz/sphinxql-query-builder)\n\n## About\n\nThis is a SphinxQL Query Builder used to work with SphinxQL, a SQL dialect used with the Sphinx search engine and it's fork Manticore. It maps most of the functions listed in the [SphinxQL reference](http://sphinxsearch.com/docs/current.html#SphinxQL-reference) and is generally [faster](http://sphinxsearch.com/blog/2010/04/25/sphinxapi-vs-SphinxQL-benchmark/) than the available Sphinx API.\n\nThis Query Builder has no dependencies except PHP 7.1 or later, `\\MySQLi` extension, `PDO`, and [Sphinx](http://sphinxsearch.com)/[Manticore](https://manticoresearch.com).\n\n### Missing methods?\n\nSphinxQL evolves very fast.\n\nMost of the new functions are static one liners like `SHOW PLUGINS`. We'll avoid trying to keep up with these methods, as they are easy to just call directly (`(new SphinxQL($conn))-\u003equery($sql)-\u003eexecute()`). You're free to submit pull requests to support these methods.\n\nIf any feature is unreachable through this library, open a new issue or send a pull request.\n\n## Code Quality\n\nThe majority of the methods in the package have been unit tested.\n\nThe only methods that have not been fully tested are the Helpers, which are mostly simple shorthands for SQL strings.\n\n## How to Contribute\n\n### Pull Requests\n\n1. Fork the SphinxQL Query Builder repository\n2. Create a new branch for each feature or improvement\n3. Submit a pull request from each branch to the **master** branch\n\nIt is very important to separate new features or improvements into separate feature branches, and to send a pull\nrequest for each branch. This allows me to review and pull in new features or improvements individually.\n\n### Style Guide\n\nAll pull requests must adhere to the [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md) standard.\n\n### Unit Testing\n\nAll pull requests must be accompanied by passing unit tests and complete code coverage. The SphinxQL Query Builder uses\n`phpunit` for testing.\n\n[Learn about PHPUnit](https://github.com/sebastianbergmann/phpunit/)\n\n## Installation\n\nThis is a Composer package. You can install this package with the following command: `composer require foolz/sphinxql-query-builder`\n\n## Usage\n\nThe following examples will omit the namespace.\n\n```php\n\u003c?php\nuse Foolz\\SphinxQL\\SphinxQL;\nuse Foolz\\SphinxQL\\Drivers\\Mysqli\\Connection;\n\n// create a SphinxQL Connection object to use with SphinxQL\n$conn = new Connection();\n$conn-\u003esetParams(array('host' =\u003e 'domain.tld', 'port' =\u003e 9306));\n\n$query = (new SphinxQL($conn))-\u003eselect('column_one', 'colume_two')\n    -\u003efrom('index_ancient', 'index_main', 'index_delta')\n    -\u003ematch('comment', 'my opinion is superior to yours')\n    -\u003ewhere('banned', '=', 1);\n\n$result = $query-\u003eexecute();\n```\n\n### Drivers\n\nWe support the following database connection drivers:\n\n* Foolz\\SphinxQL\\Drivers\\Mysqli\\Connection\n* Foolz\\SphinxQL\\Drivers\\Pdo\\Connection\n\n### Connection\n\n* __$conn = new Connection()__\n\n\tCreate a new Connection instance to be used with the following methods or SphinxQL class.\n\n* __$conn-\u003esetParams($params = array('host' =\u003e '127.0.0.1', 'port' =\u003e 9306))__\n\n\tSets the connection parameters used to establish a connection to the server. Supported parameters: 'host', 'port', 'socket', 'options'.\n\n* __$conn-\u003equery($query)__\n\n\tPerforms the query on the server. Returns a [`ResultSet`](#resultset) object containing the query results.\n\n_More methods are available in the Connection class, but usually not necessary as these are handled automatically._\n\n### SphinxQL\n\n* __new SphinxQL($conn)__\n\n\tCreates a SphinxQL instance used for generating queries.\n\n#### Bypass Query Escaping\n\nOften, you would need to call and run SQL functions that shouldn't be escaped in the query. You can bypass the query escape by wrapping the query in an `\\Expression`.\n\n* __SphinxQL::expr($string)__\n\n\tReturns the string without being escaped.\n\n#### Query Escaping\n\nThere are cases when an input __must__ be escaped in the SQL statement. The following functions are used to handle any escaping required for the query.\n\n* __$sq-\u003eescape($value)__\n\n\tReturns the escaped value. This is processed with the `\\MySQLi::real_escape_string()` function.\n\n* __$sq-\u003equoteIdentifier($identifier)__\n\n\tAdds backtick quotes to the identifier. For array elements, use `$sq-\u003equoteIdentifierArray($arr)`.\n\n* __$sq-\u003equote($value)__\n\n\tAdds quotes to the value and escapes it. For array elements, use `$sq-\u003equoteArr($arr)`.\n\n* __$sq-\u003eescapeMatch($value)__\n\n\tEscapes the string to be used in `MATCH`.\n\n* __$sq-\u003ehalfEscapeMatch($value)__\n\n\tEscapes the string to be used in `MATCH`. The following characters are allowed: `-`, `|`, and `\"`.\n\n\t_Refer to `$sq-\u003ematch()` for more information._\n\n#### SELECT\n\n* __$sq = (new SphinxQL($conn))-\u003eselect($column1, $column2, ...)-\u003efrom($index1, $index2, ...)__\n\n\tBegins a `SELECT` query statement. If no column is specified, the statement defaults to using `*`. Both `$column1` and `$index1` can be arrays.\n\n#### INSERT, REPLACE\n\nThis will return an `INT` with the number of rows affected.\n\n* __$sq = (new SphinxQL($conn))-\u003einsert()-\u003einto($index)__\n\n\tBegins an `INSERT`.\n\n* __$sq = (new SphinxQL($conn))-\u003ereplace()-\u003einto($index)__\n\n\tBegins an `REPLACE`.\n\n* __$sq-\u003eset($associative_array)__\n\n\tInserts an associative array, with the keys as the columns and values as the value for the respective column.\n\n* __$sq-\u003evalue($column1, $value1)-\u003evalue($column2, $value2)-\u003evalue($column3, $value3)__\n\n\tSets the value of each column individually.\n\n* __$sq-\u003ecolumns($column1, $column2, $column3)-\u003evalues($value1, $value2, $value3)-\u003evalues($value11, $value22, $value33)__\n\n\tAllows the insertion of multiple arrays of values in the specified columns.\n\n\tBoth `$column1` and `$index1` can be arrays.\n\n#### UPDATE\n\nThis will return an `INT` with the number of rows affected.\n\n* __$sq = (new SphinxQL($conn))-\u003eupdate($index)__\n\n\tBegins an `UPDATE`.\n\n* __$sq-\u003evalue($column1, $value1)-\u003evalue($column2, $value2)__\n\n\tUpdates the selected columns with the respective value.\n\n* __$sq-\u003eset($associative_array)__\n\n\tInserts the associative array, where the keys are the columns and the respective values are the column values.\n\n#### DELETE\n\nWill return an array with an `INT` as first member, the number of rows deleted.\n\n* __$sq = (new SphinxQL($conn))-\u003edelete()-\u003efrom($index)-\u003ewhere(...)__\n\n\tBegins a `DELETE`.\n\n#### WHERE\n\n* __$sq-\u003ewhere($column, $operator, $value)__\n\n\tStandard WHERE, extended to work with Sphinx filters and full-text.\n\n    ```php\n    \u003c?php\n    // WHERE `column` = 'value'\n    $sq-\u003ewhere('column', 'value');\n\n    // WHERE `column` = 'value'\n    $sq-\u003ewhere('column', '=', 'value');\n\n    // WHERE `column` \u003e= 'value'\n    $sq-\u003ewhere('column', '\u003e=', 'value');\n\n    // WHERE `column` IN ('value1', 'value2', 'value3')\n    $sq-\u003ewhere('column', 'IN', array('value1', 'value2', 'value3'));\n\n    // WHERE `column` NOT IN ('value1', 'value2', 'value3')\n    $sq-\u003ewhere('column', 'NOT IN', array('value1', 'value2', 'value3'));\n\n    // WHERE `column` BETWEEN 'value1' AND 'value2'\n    // WHERE `example` BETWEEN 10 AND 100\n    $sq-\u003ewhere('column', 'BETWEEN', array('value1', 'value2'));\n\t```\n\n\t_It should be noted that `OR` and parenthesis are not supported and implemented in the SphinxQL dialect yet._\n\n#### MATCH\n\n* __$sq-\u003ematch($column, $value, $half = false)__\n\n\tSearch in full-text fields. Can be used multiple times in the same query. Column can be an array. Value can be an Expression to bypass escaping (and use your own custom solution).\n\n    ```php\n    \u003c?php\n    $sq-\u003ematch('title', 'Otoshimono')\n        -\u003ematch('character', 'Nymph')\n        -\u003ematch(array('hates', 'despises'), 'Oregano');\n    ```\n\n\tBy default, all inputs are escaped. The usage of `SphinxQL::expr($value)` is required to bypass the default escaping and quoting function.\n\n\tThe `$half` argument, if set to `true`, will not escape and allow the usage of the following characters: `-`, `|`, `\"`. If you plan to use this feature and expose it to public interfaces, it is __recommended__ that you wrap the query in a `try catch` block as the character order may `throw` a query error.\n\n    ```php\n    \u003c?php\n    use Foolz\\SphinxQL\\SphinxQL;\n\n    try\n    {\n        $result = (new SphinxQL($conn))\n            -\u003eselect()\n            -\u003efrom('rt')\n            -\u003ematch('title', 'Sora no || Otoshimono', true)\n            -\u003ematch('title', SphinxQL::expr('\"Otoshimono\"/3'))\n            -\u003ematch('loves', SphinxQL::expr(custom_escaping_fn('(you | me)')));\n            -\u003eexecute();\n    }\n    catch (\\Foolz\\SphinxQL\\DatabaseException $e)\n    {\n        // an error is thrown because two `|` one after the other aren't allowed\n    }\n\t```\n\n#### GROUP, WITHIN GROUP, ORDER, OFFSET, LIMIT, OPTION\n\n* __$sq-\u003egroupBy($column)__\n\n\t`GROUP BY $column`\n\n* __$sq-\u003ewithinGroupOrderBy($column, $direction = null)__\n\n\t`WITHIN GROUP ORDER BY $column [$direction]`\n\n\tDirection can be omitted with `null`, or be `ASC` or `DESC` case insensitive.\n\n* __$sq-\u003eorderBy($column, $direction = null)__\n\n\t`ORDER BY $column [$direction]`\n\n\tDirection can be omitted with `null`, or be `ASC` or `DESC` case insensitive.\n\n* __$sq-\u003eoffset($offset)__\n\n\t`LIMIT $offset, 9999999999999`\n\n\tSet the offset. Since SphinxQL doesn't support the `OFFSET` keyword, `LIMIT` has been set at an extremely high number.\n\n* __$sq-\u003elimit($limit)__\n\n\t`LIMIT $limit`\n\n* __$sq-\u003elimit($offset, $limit)__\n\n\t`LIMIT $offset, $limit`\n\n* __$sq-\u003eoption($name, $value)__\n\n\t`OPTION $name = $value`\n\n\tSet a SphinxQL option such as `max_matches` or `reverse_scan` for the query.\n\n#### TRANSACTION\n\n* __(new SphinxQL($conn))-\u003etransactionBegin()__\n\n\tBegins a transaction.\n\n* __(new SphinxQL($conn))-\u003etransactionCommit()__\n\n\tCommits a transaction.\n\n* __(new SphinxQL($conn))-\u003etransactionRollback()__\n\n\tRollbacks a transaction.\n\n#### Executing and Compiling\n\n* __$sq-\u003eexecute()__\n\n\tCompiles, executes, and __returns__ a [`ResultSet`](#resultset) object containing the query results.\n\n* __$sq-\u003eexecuteBatch()__\n\n\tCompiles, executes, and __returns__ a [`MultiResultSet`](#multiresultset) object containing the multi-query results.\n\n* __$sq-\u003ecompile()__\n\n\tCompiles the query.\n\n* __$sq-\u003egetCompiled()__\n\n\tReturns the last query compiled.\n\n* __$sq-\u003egetResult()__\n\n\tReturns the [`ResultSet`](#resultset) or [` MultiResultSet`](#multiresultset) object, depending on whether single or multi-query have been executed last.\n\n#### Multi-Query\n\n* __$sq-\u003eenqueue(SphinxQL $next = null)__\n\n\tQueues the query. If a $next is provided, $next is appended and returned, otherwise a new SphinxQL object is returned.\n\n* __$sq-\u003eexecuteBatch()__\n\n\tReturns a [`MultiResultSet`](#multiresultset) object containing the multi-query results.\n\n```php\n\u003c?php\nuse Foolz\\SphinxQL\\SphinxQL;\n\n$result = (new SphinxQL($this-\u003econn))\n    -\u003eselect()\n    -\u003efrom('rt')\n    -\u003ematch('title', 'sora')\n    -\u003eenqueue((new SphinxQL($this-\u003econn))-\u003equery('SHOW META')) // this returns the object with SHOW META query\n    -\u003eenqueue() // this returns a new object\n    -\u003eselect()\n    -\u003efrom('rt')\n    -\u003ematch('content', 'nymph')\n    -\u003eexecuteBatch();\n```\n\n`$result` will contain [`MultiResultSet`](#multiresultset) object. Sequential calls to the `$result-\u003egetNext()` method allow you to get a [`ResultSet`](#resultset) object containing the results of the next enqueued query.\n\n\n#### Query results\n\n##### ResultSet\n\nContains the results of the query execution.\n\n* __$result-\u003efetchAllAssoc()__\n\n\tFetches all result rows as an associative array.\n\n* __$result-\u003efetchAllNum()__\n\n\tFetches all result rows as a numeric array.\n\n* __$result-\u003efetchAssoc()__\n\n\tFetch a result row as an associative array.\n\n* __$result-\u003efetchNum()__\n\n\tFetch a result row as a numeric array.\n\n* __$result-\u003egetAffectedRows()__\n\n\tReturns the number of affected rows in the case of a DML query.\n\n##### MultiResultSet\n\nContains the results of the multi-query execution.\n\n* __$result-\u003egetNext()__\n\t\n\tReturns a [`ResultSet`](#resultset) object containing the results of the next query.\n\n\n### Helper\n\nThe `Helper` class contains useful methods that don't need \"query building\".\n\nRemember to `-\u003eexecute()` to get a result.\n\n* __Helper::pairsToAssoc($result)__\n\n\tTakes the pairs from a SHOW command and returns an associative array key=\u003evalue\n\nThe following methods return a prepared `SphinxQL` object. You can also use `-\u003eenqueue($next_object)`:\n\n```php\n\u003c?php\nuse Foolz\\SphinxQL\\SphinxQL;\n\n$result = (new SphinxQL($this-\u003econn))\n    -\u003eselect()\n    -\u003efrom('rt')\n    -\u003ewhere('gid', 9003)\n    -\u003eenqueue((new Helper($this-\u003econn))-\u003eshowMeta()) // this returns the object with SHOW META query prepared\n    -\u003eenqueue() // this returns a new object\n    -\u003eselect()\n    -\u003efrom('rt')\n    -\u003ewhere('gid', 201)\n    -\u003eexecuteBatch();\n```\n\n* `(new Helper($conn))-\u003eshowMeta() =\u003e 'SHOW META'`\n* `(new Helper($conn))-\u003eshowWarnings() =\u003e 'SHOW WARNINGS'`\n* `(new Helper($conn))-\u003eshowStatus() =\u003e 'SHOW STATUS'`\n* `(new Helper($conn))-\u003eshowTables() =\u003e 'SHOW TABLES'`\n* `(new Helper($conn))-\u003eshowVariables() =\u003e 'SHOW VARIABLES'`\n* `(new Helper($conn))-\u003esetVariable($name, $value, $global = false)`\n* `(new Helper($conn))-\u003ecallSnippets($data, $index, $query, $options = array())`\n* `(new Helper($conn))-\u003ecallKeywords($text, $index, $hits = null)`\n* `(new Helper($conn))-\u003edescribe($index)`\n* `(new Helper($conn))-\u003ecreateFunction($udf_name, $returns, $soname)`\n* `(new Helper($conn))-\u003edropFunction($udf_name)`\n* `(new Helper($conn))-\u003eattachIndex($disk_index, $rt_index)`\n* `(new Helper($conn))-\u003eflushRtIndex($index)`\n* `(new Helper($conn))-\u003eoptimizeIndex($index)`\n* `(new Helper($conn))-\u003eshowIndexStatus($index)`\n* `(new Helper($conn))-\u003eflushRamchunk($index)`\n\n### Percolate\n The `Percolate` class provides methods for the \"Percolate query\" feature of Manticore Search.\n For more information about percolate queries refer the [Percolate Query](https://docs.manticoresearch.com/latest/html/searching/percolate_query.html) documentation.\n\n#### INSERT\n\nThe Percolate class provide a dedicated helper for inserting queries in a `percolate` index. \n\n```php\n\u003c?php\nuse Foolz\\SphinxQL\\Percolate;\n\n$query = (new Percolate($conn))\n     -\u003einsert('full text query terms',false)      \n     -\u003einto('pq')                                              \n     -\u003etags(['tag1','tag2'])                                  \n     -\u003efilter('price\u003e3')                                      \n     -\u003eexecute();\n ```\n\n* __`$pq = (new Percolate($conn))-\u003einsert($query,$noEscape)`__\n\n    Begins an ``INSERT``. A single query is allowed to be added per insert. By default, the query string is escaped. Optional second parameter  `$noEscape` can be set to  `true` for not applying the escape.\n\n* __`$pq-\u003einto($index)`__\n\n   Set the percolate index for insert.\n\n* __`$pq-\u003etags($tags)`__\n\n   Set a list of tags per query. Accepts array of strings or string delimited by comma\n\n* __`$pq-\u003efilter($filter)`__\n   Sets an attribute filtering string. The string must look the same as string of an WHERE attribute filters clause\n\n* __`$pq-\u003eexecute()`__\n\n   Execute the `INSERT`.\n\n#### CALLPQ\n\n  Searches for stored queries that provide matching for input documents.\n  \n```php\n\u003c?php\nuse Foolz\\SphinxQL\\Percolate;\n$query = (new Percolate($conn))\n     -\u003ecallPQ()\n     -\u003efrom('pq')                                              \n     -\u003edocuments(['multiple documents', 'go this way'])        \n     -\u003eoptions([                                               \n           Percolate::OPTION_VERBOSE =\u003e 1,\n           Percolate::OPTION_DOCS_JSON =\u003e 1\n     ])\n     -\u003eexecute();\n ```\n\n* __`$pq = (new Percolate($conn))-\u003ecallPQ()`__\n\n   Begins a `CALL PQ`\n\n* __`$pq-\u003efrom($index)`__\n\n   Set percolate index.\n\n* __`$pq-\u003edocuments($docs)`__\n\n   Set the incoming documents. $docs can be:\n   \n  - a single plain string (requires `Percolate::OPTION_DOCS_JSON` set to 0)\n  - array of plain strings (requires `Percolate::OPTION_DOCS_JSON` set to 0)\n  - a single JSON document\n  - an array of JSON documents\n  - a JSON object containing an  array of JSON objects\n   \n\n* __`$pq-\u003eoptions($options)`__\n\n    Set options of `CALL PQ`. Refer the Manticore docs for more information about the `CALL PQ` parameters.\n    \n  - __Percolate::OPTION_DOCS_JSON__ (`as docs_json`) default to 1 (docs are json objects). Needs to be set to 0 for plain string documents.\n        Documents added as associative arrays will be converted to JSON when sending the query to Manticore.\n   - __Percolate::OPTION_VERBOSE__ (`as verbose`) more information is printed by following `SHOW META`, default is 0\n   - __Percolate::OPTION_QUERY__  (`as query`) returns all stored queries fields , default is 0\n   - __Percolate::OPTION_DOCS__  (`as docs`) provide result set as per document matched (instead of per query), default is 0\n\n* `$pq-\u003eexecute()`\n\n   Execute the `CALL PQ`.\n\n## Laravel\n\nLaravel's dependency injection and realtime facades brings more convenience to SphinxQL Query Builder usage.\n\n```php\n// Register connection:\nuse Foolz\\SphinxQL\\Drivers\\ConnectionInterface;\nuse Foolz\\SphinxQL\\Drivers\\Mysqli\\Connection;\nuse Illuminate\\Support\\ServiceProvider;\n\nclass AppServiceProvider extends ServiceProvider\n{\n    public function register()\n    {\n        $this-\u003eapp-\u003esingleton(ConnectionInterface::class, function ($app) {\n            $conn = new Connection();\n            $conn-\u003esetParams(['host' =\u003e 'domain.tld', 'port' =\u003e 9306]);\n            return $conn;\n        });\n    }\n}\n\n// In another file:\nuse Facades\\Foolz\\SphinxQL\\SphinxQL;\n\n$result = SphinxQL::select('column_one', 'colume_two')\n    -\u003efrom('index_ancient', 'index_main', 'index_delta')\n    -\u003ematch('comment', 'my opinion is superior to yours')\n    -\u003ewhere('banned', '=', 1)\n    -\u003eexecute();\n```\n\nFacade access also works with `Helper` and `Percolate`.\n","funding_links":[],"categories":["Table of Contents","目录","PHP"],"sub_categories":["Search","搜索 Search"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/foolcode.github.io%2FSphinxQL-Query-Builder%2F","html_url":"https://awesome.ecosyste.ms/projects/foolcode.github.io%2FSphinxQL-Query-Builder%2F","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/foolcode.github.io%2FSphinxQL-Query-Builder%2F/lists"}