Reputation: 15089
I have a folder, that contains a library, that was created by composer (aka, the folder's name is vendor
and there is an autoload.php
file).
Can I use Yii's import
section to autoload this library instead of require
-ing it in the index.php
? If so, how? I tried making an alias to the vendor
folder and then doing
'import'=>[
'alias_to_lib_folder.autoload.php'
'alias_to_lib_folder.*'
'alias_to_lib_folder.autoload'
]
but none of those works.
Regards
Upvotes: 0
Views: 161
Reputation: 26
You can't load composer-generated folder from Yii's main config.
However where are few other ways to load it.
For example, you can import it in Controller.php like this:
<?php
class Controller extends CController
{
public function init()
{
Yii::import('alias_to_lib_folder.autoload', true);
}
}
Upvotes: 1