PHPackages                             eresults/email-template-bundle - 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. eresults/email-template-bundle

ActiveSymfony-bundle[Templating &amp; Views](/categories/templating)

eresults/email-template-bundle
==============================

Easily render email subject, body, etc. from a single template or even a database entry.

1.0.0(5y ago)0857MITPHPPHP &gt;=7.4CI failing

Since Jun 18Pushed 5y ago1 watchersCompare

[ Source](https://github.com/eResults/email-template-bundle)[ Packagist](https://packagist.org/packages/eresults/email-template-bundle)[ Docs](http://github.com/eresults/email-template-bundle)[ RSS](/packages/eresults-email-template-bundle/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (2)Used By (0)

EmailTemplateBundle
===================

[](#emailtemplatebundle)

`eResults\EmailTemplateBundle` lets you use a single template to encapsulate all aspects of an email, like subject body and even From, CC &amp; BCC fields. This also allows you to store (Twig) templates in your database.

Requirements
------------

[](#requirements)

- PHP &gt;=7.4
- Symfony ^4.4|^5.0

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

[](#installation)

```
composer req eresults/email-template-bundle
```

### Add bundle to your application kernel

[](#add-bundle-to-your-application-kernel)

```
// app/AppKernel.php
public function registerBundles()
{
    $bundles = [
        // ...
        new eResults\EmailTemplateBundle\eResultsEmailTemplateBundle(),
    ];
}
```

Usage
-----

[](#usage)

- Create registration email template in your app

```
templates/email/user_registered.html.twig

```

- Edit template

```
// templates/email/user_registered.html.twig
{% extends '@eResultsEmailTemplateBundle/email.html.twig' %}

{% block from -%}
example@example.org
{%- endblock %}

{% block subject -%}
Thanks for registering {{ first_name }}!
{%- endblock %}

{% block body -%}
Hello {{ first_name }},

Thank you for registering at our website! below your account details:

First Name: {{ first_name }}
Last Name: {{ last_name }}
Email: {{ email }}

Thanks
{%- endblock %}
```

- Now you can send it from your controller

```
