How To Create A New Component


I’m implementing a component for sending emails through Mandrill. These are my steps :

  1. add "mandrill/mandrill": "dev-master" to composer.json

  2. run php composer.phar update --prefer-dist

  3. Create a file in created folder by composer. In this case is vendor/mandrill/mandrill/MandrillMailer.php. And declare the namespace of this class is mandrill

  4. change the class of the ‘mail’ config in main.php

But when I call \Yii::$app->mail, it show error :

Any Ideas what I’m wrong ??


Can you try declaring namespace as mandrill\mandrill

Thanks for reply, but I tried this too, not working . Any ideas else ?

Check your vendor/yiisoft/extensions.php.

I guess you need to add the following to composer.json:

"autoload": {

	"psr-4": {

		"mandrill\\mandrill\\": ""



Thanks so much, I’ve fixed this.