I installed Foolz SphinxQL Query Builder for PHP with composer using the following json file:
{
"require": {
"foolz/sphinxql-query-builder": "^2.0"
}
}
My php is as follows:
<?php
require_once __DIR__ . '/vendor/autoload.php';
use Foolz\SphinxQL\SphinxQL;
use Foolz\SphinxQL\Connection;
error_reporting(E_ALL);
ini_set('display_errors', 1);
// create a SphinxQL Connection object to use with SphinxQL
$conn = new Connection();
$conn->setConnectionParams('127.0.0.1', 9306);
$query = SphinxQL::create($conn)->select('*')
->from('test1')
->match('@test document');
# ->where('banned', '=', 1);
$result = $query->execute();
var_dump($result);
?>
Using my debugger I see the autoloader (function findFileWithExtension
) is trying to find the file at /mnt/i/var/www/vhosts/my.play.net/sphinx/vendor/composer/../foolz/sphinxql-query-builder/Connection.php
when it should presumably be looking in /mnt/i/var/www/vhosts/my.play.net/sphinx/vendor/composer/../foolz/sphinxql-query-builder/Drivers/Mysqli/Connection.php
where it is actually located.
Can anyone advise why I might be seeing this and how I fix it?
You're using incorrect namespace. To get vendor/foolz/sphinxql-query-builder/src/Drivers/Mysqli/Connection.php
you need to use Foolz\SphinxQL\Drivers\Mysqli\Connection
as FQN:
use Foolz\SphinxQL\SphinxQL;
use Foolz\SphinxQL\Drivers\Mysqli\Connection;