Introduction¶
SphinxQL Query Builder provides a fluent PHP API for SphinxQL and ManticoreQL.
It is designed for teams that want:
readable query composition
safe value quoting/escaping via connection drivers
testable SQL compilation (compile() + getCompiled())
helper wrappers for common engine commands
Supported drivers:
Foolz\\SphinxQL\\Drivers\\Mysqli\\ConnectionFoolz\\SphinxQL\\Drivers\\Pdo\\Connection
Quick Example¶
<?php
use Foolz\SphinxQL\Drivers\Mysqli\Connection;
use Foolz\SphinxQL\SphinxQL;
$conn = new Connection();
$conn->setParams([
'host' => '127.0.0.1',
'port' => 9306,
]);
$rows = (new SphinxQL($conn))
->select('id', 'gid', 'title')
->from('rt')
->match('title', 'vacation')
->where('gid', '>', 300)
->orderBy('id', 'DESC')
->limit(5)
->execute()
->getStored();
Compile-First Workflow¶
Compiling queries before execution is useful for debugging and tests.
<?php
use Foolz\SphinxQL\SphinxQL;
$sql = (new SphinxQL($conn))
->select('a.id')
->from('rt a')
->leftJoin('rt b', 'a.id', '=', 'b.id')
->where('a.id', '>', 1)
->compile()
->getCompiled();
// SELECT a.id FROM rt a LEFT JOIN rt b ON a.id = b.id WHERE a.id > 1
Where To Next¶
Configuration for connection parameters and driver notes
SphinxQL Query Builder for full query API with examples
Helper API for SHOW/CALL/maintenance wrappers
Percolate (Manticore) for Manticore percolate workflows