SphinxQL and namespaces

There is a wonderful library for Sphinx. The library uses namespaces and I have some problems with it. I cannot figure out how to make it work. I need your help.


use Foolz\SphinxQL;

use Foolz\SphinxQL\Connection;

// create a SphinxQL Connection object to use with SphinxQL

$conn = new Connection();

$conn->setParams(array('host' => 'domain.tld', 'port' => 9306));

//rest of code ...

Pretty easy. The official yii manual says:

Yii::setPathOfAlias('mynamespace', '/var/www/common/mynamespace/');

And I did this way. I tried following:

Yii::setPathOfAlias('Foolz\SphinxQL\SphinxQL', '/home/user/project/common/extensions/SphinxQL/');

Yii::setPathOfAlias('Foolz\SphinxQL\Connection', '/home/user/project/common/extensions/SphinxQL/');

And this way

Yii::setPathOfAlias('Foolz\SphinxQL', '/home/user/project/common/extensions/SphinxQL/');

And this still doesn’t work.

Actually I don’t really understand how yii includes files. I tried import them but it doesnt work either.

Maybe someone knows or guesses about solution?

I don’t know whether what you’re doing is the correct approach, but that aside, you need to double up your backslashes. At the moment, you’re just escaping the next letter in the string.

A cant understand which string’s ending is wrong in your opinion?

You need to escape backslash characters to use them in a string, so:


should be:


Oh I did this way. Doesnt work. Even autoloader doesnt want to include these files that are inside the directory.

I found a stupid solution. I changed namespaces inside the library from "Foolz\\SphinxQL" to "SphinxQL" and it works great.