0

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?

rob006
  • 21,383
  • 5
  • 53
  • 74
Nick Weavers
  • 534
  • 7
  • 23

1 Answers1

4

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;
rob006
  • 21,383
  • 5
  • 53
  • 74
  • Thanks, sorry I'm new to it and was using the example given on their web page http://foolcode.github.io/SphinxQL-Query-Builder/. – Nick Weavers Mar 04 '19 at 20:08
  • This is probably documentation for 1.x line, something have been changed in 2.x line. – rob006 Mar 04 '19 at 20:11