Trouble replacing SwiftMailer with Mailjet: who keeps wanting Swift?!

Mission: use MailJet transaction service

Problem: Yii2 always wants to instantiate the SwiftMailer instead.

Advanced app template, common config:


        // MailJet vendor/weluse and vendor mailjet

        'mailer' => [

            'class' => 'common\modules\jet\Mailer',

            'apikey' => '',

            'secret' => '',

            'useFileTransport' => true,

            'viewPath' => '@common/mail',


    "require": {

        "php": ">=5.4.0",

        "yiisoft/yii2": ">=2.0.6",

        "yiisoft/yii2-bootstrap": "*",

        "yiisoft/yii2-swiftmailer": "*",

        "mdmsoft/yii2-admin": "~2.0",

        "guzzlehttp/guzzle": "^6.2",

        "mailjet/mailjet-apiv3-php": "^1.1",

        "kartik-v/yii2-slider": "dev-master",

        "kartik-v/yii2-widget-colorinput": "*",

        "weluse/yii2-mailjet": "^0.1.1"



Setting unknown property: yii\swiftmailer\Mailer::apikey

Initial testing with the weluse mailejt component worked.

Then I found issues with the weluse mailjet component, I copied into my own namespace to make it my own.

When I change the name from ‘mailer’ to ‘mailjet’ then \Yii->$app->mailjet->compose() etc works.

So I do not think I have broken the component.

But I have switched from basic to advanced template.

I have scoured the configs for ‘yii\swiftmailer\Mailer’, the only place I find it active is in yii/base Application::coreComponents()

I commented that out just to see, and it made no difference?

I’ve done something funky. Anyone recognize the issue? Thank you.

I guess this is SOP for anyone switching from the basic to advanced template.

Take a blob like this…

$config = yii\helpers\ArrayHelper::merge(

    require(__DIR__ . '/../../common/config/main.php'),

    require(__DIR__ . '/../../common/config/main-local.php'),

    require(__DIR__ . '/../config/main.php'),

    require(__DIR__ . '/../config/main-local.php')


… and start dumping out the config array after each file is required.

The issue becomes obvious. Further, I find all kinds of files and configs I was unaware of.

This could become very hairy over time, with many entry points and environments.

So will some bright young fellow please write a GUI to read and depict all the possible paths and scenarios.

Make it an editor while you’re at it, with drag n drop so we can rearrange the config items and save to the project.

Delivery by next Monday, thank you very much.