ignatenkovnikita/yii2-template-messages

Template Message with placeholder

v1.0 2017-06-27 21:30 UTC

This package is auto-updated.

Last update: 2024-11-29 04:57:57 UTC


README

Template Message with placeholder

Latest Stable Version Total Downloads Latest Unstable Version License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist ignatenkovnikita/yii2-template-messages "*"

or add

"ignatenkovnikita/yii2-template-messages": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

'modules'=>[
        'template' => [
            'class' => 'ignatenkovnikita\template\Module',
        ],
    ],

In Code uses

Template::replace('template_name', [
        'your_variable' => 'value
]);

Example Add in migration

  $rows = [
            [
                'promo-code-send',
                'Отправка купона пользователю',
                '["promo_code"]',
                'Трэк {promo_code}'
            ],

        ];

        $this->batchInsert('{{template}}', ['id', 'title', 'placeholders', 'message'], $rows);


        $this->update('{{%template}}',['widget_options' => '{"toolbar":false,"pastePlainText":true,"buttonSource":true,"paragraphize":false}']);

Apply migration

./console/yii migrate --migrationPath=vendor/ignatenkovnikita/yii2-template-messages/migrations/ 

TODO

  • add suppport email
  • refactoring