How to put a vendor path for a new module in config main?


(Juanmjimenezs) #1

I am adding a new module for rollbar and the instructions from rollbar said that I had to add the next code in ‘components’:

'rollbar' => array(
	'class' => 'application.vendor.baibaratsky.yii-rollbar.RollbarComponent',
	'access_token' => 'the-token',
),

But that path for the class it is trying to find ‘vendor/’ folder inside ‘protected/’ folder and I don’t know how to change that path to find vendor in the same level of ‘protected/’, I mean, ‘vendor/’ is outside of ‘protected/’, can you help me?

By the way, the error I get is:

PHP Error

require(/home/juanmjimenezs/Documentos/backoffice/protected/vendor/baibaratsky/yii-rollbar/RollbarComponent.php): failed to open stream: No such file or directory

Thanks!


(Juanmjimenezs) #2

I found the solution, it was that I have to create an alias in the config main like this…

// Aliases
'aliases' => array(
   'vendor' => dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'vendor'
),

Next, I had to erase ‘application.’ so ‘vendor’ itself is the new alias for that route. I mean the code should be something like this:

'rollbar' => array(
	 'class' => 'vendor.baibaratsky.yii-rollbar.RollbarComponent',
	 'access_token' => 'the-token',
),