/** @var LanguageManager $languageManager */
$languageManager = Yii::$app->languageManager;
class Yii extends \yii\BaseYii
{
/**
* @var BaseApplication|WebApplication|ConsoleApplication
*/
public static $app;
}
/**
* @property backend\components\bootstrap\SectionTreeManager $sectionTreeManager
* @property backend\components\constructor\Component $constructor
* @property backend\components\rbac\SystemAuthManager $systemAuthManager
* @property backend\components\rbac\UserAuthManager $userAuthManager
* @property common\components\language\LanguageManager $languageManager
* @property common\components\view\ViewBlockManager $viewBlock
*/
abstract class BaseApplication extends \yii\base\Application {}
/**
* @property backend\components\bootstrap\SectionTreeManager $sectionTreeManager
* @property backend\components\constructor\Component $constructor
* @property backend\components\rbac\SystemAuthManager $systemAuthManager
* @property backend\components\rbac\UserAuthManager $userAuthManager
* @property common\components\language\LanguageManager $languageManager
* @property common\components\view\ViewBlockManager $viewBlock
*/
class WebApplication extends \yii\web\Application {}
/**
* @property backend\components\bootstrap\SectionTreeManager $sectionTreeManager
* @property backend\components\constructor\Component $constructor
* @property backend\components\rbac\SystemAuthManager $systemAuthManager
* @property backend\components\rbac\UserAuthManager $userAuthManager
* @property common\components\language\LanguageManager $languageManager
* @property common\components\view\ViewBlockManager $viewBlock
*/
class ConsoleApplication extends \yii\console\Application {}
/** @return CWebApplication|CConsoleApplication */
function app()
{
return Yii::$app;
}
/** @return CHttpRequest */
function req()
{
return Yii::$app->getComponent('request');
}
'mailer' => [
'class' => 'yii\swiftmailer\Mailer',
'viewPath' => '@app/mail',
'transport' => [
'class' => 'Swift_SmtpTransport',
'host' => 'email-smtp.us-west-2.amazonaws.com',
'username' => 'anu4yzgRtf3YP6Vq431QA6iqlatm',
'password' => 'erBYPWIDq/banu4yzgRtf',
'port' => '587',
'encryption' => 'tls',
],
//'useFileTransport' => true,
],
$HTML = \Yii::$app->view->render('@app/mail/remind', [
'token' => $user->password_reset_token,
'email' => $user->email,
'url' => $url
]);
Yii::$app->mailer->compose()
->setFrom('ОТ кого')
->setTo('Кому')
->setSubject('Тема')
->setHtmlBody( $HTML )
->send();
Yii::$app->mailer->compose('contact/html')
->setFrom('from@domain.com')
->setTo($form->email)
->setSubject($form->subject)
->send();
$connection = new \yii\db\Connection([
'dsn' => $dsn,
'username' => $username,
'password' => $password,
]);
$connection->open();