PHPackages                             black-lamp/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. [Templating &amp; Views](/categories/templating)
4. /
5. black-lamp/yii2-email-templates

ActiveYii2-extension[Templating &amp; Views](/categories/templating)

black-lamp/yii2-email-templates
===============================

Module for adding templates for email letters across dashboard

3.1.1(9y ago)109475[1 issues](https://github.com/black-lamp/yii2-email-templates/issues)4BSD-3-ClausePHPPHP &gt;=5.6.0

Since Nov 29Pushed 9y ago4 watchersCompare

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

READMEChangelog (8)Dependencies (6)Versions (9)Used By (4)

Email templates module for Yii2
===============================

[](#email-templates-module-for-yii2)

Module for adding templates for email letters across dashboard

[![Build Status](https://camo.githubusercontent.com/0b4aff8c3251adecd22449759090f5158d7a0b27bc99c0acfb2bec2c4a28fa83/68747470733a2f2f7472617669732d63692e6f72672f626c61636b2d6c616d702f796969322d656d61696c2d74656d706c617465732e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/black-lamp/yii2-email-templates)[![Latest Stable Version](https://camo.githubusercontent.com/badba76b557a1ff4707f903b8214f6bf9f2a3dff902a28b93572647ef44be099/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d656d61696c2d74656d706c617465732f762f737461626c65)](https://packagist.org/packages/black-lamp/yii2-email-templates)[![Latest Unstable Version](https://camo.githubusercontent.com/11a671a1fc00d5dafc69043c3face1ccfb98b9201684ff3a143b92828e133696/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d656d61696c2d74656d706c617465732f762f756e737461626c65)](https://packagist.org/packages/black-lamp/yii2-email-templates)[![License](https://camo.githubusercontent.com/9deb3927133d37454a3cf785b057245c9a50b9715cd4e310c696635c4e0bbca1/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d656d61696c2d74656d706c617465732f6c6963656e7365)](https://packagist.org/packages/black-lamp/yii2-email-templates)

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

[](#installation)

#### Run command

[](#run-command)

```
composer require black-lamp/yii2-email-templates

```

or add

```
"black-lamp/yii2-email-templates": "^3.0.0"
```

to the require section of your composer.json.

#### Applying migrations

[](#applying-migrations)

```
yii migrate --migrationPath=@vendor/black-lamp/yii2-email-templates/src/migrations

```

#### Add module to application config

[](#add-module-to-application-config)

Backend module for create, edit and delete email templates

```
'modules' => [
     // ...
     'email-templates' => [
         'class' => bl\emailTemplates\EmailTemplates::class,
         'languageProvider' => [
            'class' => bl\emailTemplates\providers\DbLanguageProvider::class,
            'tableName' => 'language',
            'idField' => 'id',
            'nameField' => 'name'
         ]
     ],
]
```

`languageProvider` it's a class that implements [LanguageProviderInterface](https://github.com/black-lamp/yii2-email-templates/blob/master/src/providers/LanguageProviderInterface.php). You can use language providers from this extension or create yours. This extension has two language providers.

##### Database language provider configuration properties

[](#database-language-provider-configuration-properties)

OptionDescriptionTypeDefaulttableNameName of table in database with languagesstringlanguageidFieldName of field in language table with primary keystringididNameName of field in language table with language namestringname##### Config language provider configuration properties

[](#config-language-provider-configuration-properties)

OptionDescriptionTypeDefaultlanguagesArray with languages. Example `[1 => 'English', 2 => 'Russian']`array-defaultLanguageArray with default language. Array must contains one value. Example `[1 => 'English']`array-#### Add component to application config

[](#add-component-to-application-config)

Component for getting the templates from database

```
'components' => [
    // ...
    'emailTemplates' => [
        'class' => bl\emailTemplates\components\TemplateManager::class
    ],
]
```

Using
-----

[](#using)

1. Create the template with markers across dashboard

Email subject

> New message from {sitename}

Email body

> Hello, {username}!
>
> Text...
>
> Go to the link - {link}

2. Get template by key with component help

```
$template = Yii::$app->templateManager->getTemplate('test', 1);
```

This method return a [Template](https://github.com/black-lamp/yii2-email-templates/blob/master/src/data/Template.php) object.

3. You should to parse the markers in email subject and email body

```
    $template->parseSubject([
        '{sitename}' => $sitename
    ]);

    $template->parseBody([
        '{username}' => Yii::$app->user->identity->firstname,
        '{link}' => Url::toRoute(['/confirm', 'token' => $token], true)
    ]);
```

4. Now you can using this template

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

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 97.5% 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 ~24 days

Recently: every ~38 days

Total

8

Last Release

3285d ago

Major Versions

1.0.2 → 2.0.02016-12-13

2.1.0 → 3.0.02017-01-17

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e1784ec992318bf7ed40a2025a0ca035a01143de89054f0f4c9bc39469928c1?d=identicon)[GutsVadim](/maintainers/GutsVadim)

---

Top Contributors

[![greeflas](https://avatars.githubusercontent.com/u/17636915?v=4)](https://github.com/greeflas "greeflas (39 commits)")[![GutsVadim](https://avatars.githubusercontent.com/u/9513738?v=4)](https://github.com/GutsVadim "GutsVadim (1 commits)")

---

Tags

black-lampphpyii-extensionyii2emailtemplateyii2moduledelivery

###  Code Quality

TestsCodeception

### Embed Badge

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

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

###  Alternatives

[yiister/yii2-adminlte

yii2-adminlte is a package for yii framework 2 that consists a very popular backend template AdminLTE (based on bootstrap 3).

2839.3k](/packages/yiister-yii2-adminlte)

PHPackages © 2026

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