PHPackages                             yiimaker/yii2-email-templates - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Mail &amp; Notifications](/categories/mail)
4. /
5. yiimaker/yii2-email-templates

ActiveYii2-extension[Mail &amp; Notifications](/categories/mail)

yiimaker/yii2-email-templates
=============================

Extension for creating of email templates and manage using your site dashboard

v4.1.2(1y ago)9219.4k—0%18[2 issues](https://github.com/yiimaker/yii2-email-templates/issues)1BSD-3-ClausePHPPHP &gt;=5.6.0

Since Jun 14Pushed 1y ago15 watchersCompare

[ Source](https://github.com/yiimaker/yii2-email-templates)[ Packagist](https://packagist.org/packages/yiimaker/yii2-email-templates)[ RSS](/packages/yiimaker-yii2-email-templates/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (6)Versions (17)Used By (1)

[![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct.svg)](https://stand-with-ukraine.pp.ua)

 [ ![](https://avatars1.githubusercontent.com/u/24204902) ](https://github.com/yiimaker)

Email templates module
======================

[](#email-templates-module)

Extension for creating email templates and managing by using your site dashboard. You can create email templates with CRUD module in your backend or Gii generator.

Documentation is at [docs/guide/README.md](docs/guide/README.md).

[![Build Status](https://camo.githubusercontent.com/0c3fc1a62d7e8f2e28391e6040db3d9c79791b2dbd3ccdc2e909b1334c9f9988/68747470733a2f2f7472617669732d63692e6f72672f7969696d616b65722f796969322d656d61696c2d74656d706c617465732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/yiimaker/yii2-email-templates)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ad955a1f92952e85f1986b29b992463b748e1211153d4386d37e0c31de861aef/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f7969696d616b65722f796969322d656d61696c2d74656d706c617465732f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/yiimaker/yii2-email-templates/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/211a00ce1da7de959ef40452d5d957b57142c06d1f0b6812d9424ed1d17b7753/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7969696d616b65722f796969322d656d61696c2d74656d706c617465732e737667)](https://packagist.org/packages/yiimaker/yii2-email-templates)[![Latest Stable Version](https://camo.githubusercontent.com/2571e6588ae9b69f4f96b9e68f7b218875d33c55d096f616dc359d2540c83f12/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7969696d616b65722f796969322d656d61696c2d74656d706c617465732e737667)](https://packagist.org/packages/yiimaker/yii2-email-templates)[![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
$ composer require yiimaker/yii2-email-templates

```

or add

```
"yiimaker/yii2-email-templates": "~4.1"

```

to the `require` section of your `composer.json`.

Usage
-----

[](#usage)

1. Create template with placeholders using your site dashboard or Gii generator

    ##### Key

    [](#key)

    `register-notification` - this is unique key of this template for using in your code

    ##### Subject

    [](#subject)

    `Notification from {site-name}`

    In this example email subject has one placeholder `{site-name}`

    ##### Body

    [](#body)

    `Hello, {username}! Welcome to {site-name} :)`

    Email body has two placeholders: `{username}` and `{site-name}`.

    > All keys should be wrapped by `{}`.
2. Now you can get this template in your code

    ```
    $template = Yii::$app->get('templateManager')->getTemplate('register-notification');
    ```

    This method returns a template model object.
3. Then you should parse this template

    ```
    $template->parseSubject([
       'site-name' => Yii::$app->name,
    ]);

    $template->parseBody([
       'username' => Yii::$app->getIdentity()->username,
       'site-name' => Yii::$app->name,
    ]);
    ```

    or use another method

    ```
    $template->parse([
       'subject' => [
           'site-name' => Yii::$app->name,
       ],
       'body' => [
           'username' => Yii::$app->getIdentity()->username,
           'site-name' => Yii::$app->name,
       ],
    ]);
    ```

    this methods replace placeholders in template with real data.
4. Now you can use data of this template in your logic

    ```
    Yii::$app->get('mailer')->compose()
        ->setSubject($template->subject)
        ->setHtmlBody($template->body)
        // ...
    ```

Tests
-----

[](#tests)

You can run tests with composer command

```
$ composer test

```

or using following command

```
$ codecept build && codecept run

```

Contributing
------------

[](#contributing)

For information about contributing please read [CONTRIBUTING.md](CONTRIBUTING.md).

Sponsoring
----------

[](#sponsoring)

[![Buy Me A Coffee](https://camo.githubusercontent.com/0cf29a542375e1a46e84d8bf5805a4e5c0a6ee98b6547ccdc0c55eed49d99c69/68747470733a2f2f63646e2e6275796d6561636f666665652e636f6d2f627574746f6e732f76322f64656661756c742d79656c6c6f772e706e67)](https://www.buymeacoffee.com/OCmHjEY)

License
-------

[](#license)

[![License](https://camo.githubusercontent.com/a328acac970472ebcec6e2b81acd9f7f7e327898a97b6ca6f2f98c7cf985957c/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f7969696d616b65722f796969322d656d61696c2d74656d706c617465732e737667)](LICENSE)

This project is released under the terms of the BSD-3-Clause [license](LICENSE).

Copyright (c) 2017-2022, Yii Maker

###  Health Score

45

—

FairBetter than 92% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity41

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 88% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~178 days

Recently: every ~579 days

Total

16

Last Release

587d ago

Major Versions

1.1.1 → 2.0.02017-09-11

2.1.0 → 3.0.02017-12-22

3.0.1 → v4.0.02018-04-22

### Community

Maintainers

![](https://www.gravatar.com/avatar/81dbf9eb881773e58a5472007499612c6e0c93007a75336688a1a21b9630dc1e?d=identicon)[YiiMaker](/maintainers/YiiMaker)

![](https://www.gravatar.com/avatar/9c7243572d974ba9ce049b0a67fd95cf547fd62ea531784d2dfbcc1fbee16806?d=identicon)[greeflas](/maintainers/greeflas)

---

Top Contributors

[![greeflas](https://avatars.githubusercontent.com/u/17636915?v=4)](https://github.com/greeflas "greeflas (146 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (12 commits)")[![Geoffry304](https://avatars.githubusercontent.com/u/3656871?v=4)](https://github.com/Geoffry304 "Geoffry304 (2 commits)")[![philippfrenzel](https://avatars.githubusercontent.com/u/2319890?v=4)](https://github.com/philippfrenzel "philippfrenzel (1 commits)")[![pptyasar](https://avatars.githubusercontent.com/u/21305090?v=4)](https://github.com/pptyasar "pptyasar (1 commits)")[![punkoder](https://avatars.githubusercontent.com/u/15972398?v=4)](https://github.com/punkoder "punkoder (1 commits)")[![seesoft-dev](https://avatars.githubusercontent.com/u/5937278?v=4)](https://github.com/seesoft-dev "seesoft-dev (1 commits)")[![edzima](https://avatars.githubusercontent.com/u/15854971?v=4)](https://github.com/edzima "edzima (1 commits)")[![GT-Volk](https://avatars.githubusercontent.com/u/4991297?v=4)](https://github.com/GT-Volk "GT-Volk (1 commits)")

---

Tags

email-template-generatoremail-templatesgiimail-templatesyii2yii2-extensionemailtemplatesyii2modulegiiplaceholders

###  Code Quality

TestsCodeception

Code StylePHP CS Fixer

### Embed Badge

![Health badge](/badges/yiimaker-yii2-email-templates/health.svg)

```
[![Health](https://phpackages.com/badges/yiimaker-yii2-email-templates/health.svg)](https://phpackages.com/packages/yiimaker-yii2-email-templates)
```

###  Alternatives

[loveorigami/yii2-notification-wrapper

This module for renders a message from session flash (with ajax, pjax support and etc.)

77199.7k5](/packages/loveorigami-yii2-notification-wrapper)[nterms/yii2-mailqueue

Email queue component for yii2 that works with yii2-swiftmailer.

87129.2k2](/packages/nterms-yii2-mailqueue)[boundstate/yii2-mailgun

Mailgun integration for the Yii framework

28160.6k](/packages/boundstate-yii2-mailgun)[rmrevin/yii2-postman

Mail module for Yii2.

2612.3k](/packages/rmrevin-yii2-postman)[djagya/yii2-sparkpost

A library provides Yii2 integration with SparkPost mail service

1816.3k](/packages/djagya-yii2-sparkpost)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
