Directory independent extensions

How to implement directory independent extensions ¶

Many people want to use downloaded extensions in their own way. As for me most of the extensions require me to correct Yii::import() instructions inside their source code. All these extensions are directory dependent. To avoid the situation described above, I suggest to implement pseudo-anonymous aliases:

// take the current extension path
$dir = dirname(__FILE__);
// generate alias name
$alias = md5($dir);
// create alias
// import other classes
//if you want, you can destroy an alias created

Using this technique you can create really directory-independent extensions.