I am trying to put MaxMind's GeoIp2 into my Yii application. Basically, I copied the files under "src" (see previous link) under protected -> vendors -> maxmind
. The folder structure under my application is the following:
protected
|---- vendors
|---- Zend
|---- maxmind
|---- Database
|---- Reader.php
|---- Model
|---- ...
|---- ...
After that, I created the path aliases into my index.php file:
Yii::setPathOfAlias('Zend', Yii::getPathOfAlias('application.vendors.Zend'));
Yii::setPathOfAlias('GeoIp2', Yii::getPathOfAlias('application.vendors.maxmind'));
The path works just fine for the 'Zend' alias, but it fails for 'GeoIp2' by returning null
.
Yii::createApplication("FrontendApplication", $config)->run();
echo "Path 1: " . Yii::getPathOfAlias("Zend"). '<br />'; // Correct path!
echo "Path 2: " . Yii::getPathOfAlias("GeoIp2"). '<br />'; // <==== NULL
echo "Maxmind path: " . Yii::getPathOfAlias('application.vendors.maxmind'). '<br />'; // correct path
var_dump(is_dir(Yii::getPathOfAlias('application.vendors.maxmind'))); // true
Any ideas why this could happen?
Thanks!