Download the PHP package devture/symfony-email-template-bundle without Composer

On this page you can find all versions of the php package devture/symfony-email-template-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package symfony-email-template-bundle

Description

Bundle providing:

Email Templates managed by this bundle are Twig templates, which you edit through the web UI. Each "template" can be localized to multiple languages.

The templates are stored on the filesystem as YAML files using Gaufrette. This allows you to version-control them along with your project's source code.

Prerequisites

This bundles depends on devture/form.

Before you can get this bundle working, you'd need a working devture/form setup.

Minimally, you need to define the following services somewhere (possibly in a devture-form.yaml file in your AppBundle):

Additionally, your config/packages/twig.yaml needs to have this additional path added to it: "%kernel.project_dir%/vendor/devture/form/src/Devture/Component/Form/Resources/views"

Installation

Install through composer (composer require devture/symfony-email-template-bundle).

Add to config/bundles.php:

Configuration

You can drop the following configuration in config/packages/devture_email_template.yaml

email_template_storage_path is the directory where the templates would be stored. It needs to be writable by your web server user.

locales needs to contain all languages that you're translating your email templates to.

fallback_locale_key specifies which language to fall back to in case a template is not available in the language requested.

email_wrapper_path is a layout file for the actual email message. A sample one is provided in the bundle (@DevtureEmailTemplate/email-wrapper.html.twig), but feel free to make your own.

webui_twig_layout_path is the path to your layout file, which would contain the email template system's web UI. The only requirement is that it defines a content block and a js block. The translation system would render its HTML content within the content block and its JS code within the js block.

Example layout file:

editable controls whether the templates are editable through the web UI or if they'd be displayed as readonly. In any case, your production environment would not even mount the web UI routes, thus preventing all edits.

Routing example

You most likely want this bundle's web UI active only for your development (dev) environment. Thus, you can drop the following routing config in config/routes/dev/DevtureEmailTemplateBundle.yaml:

The Web UI is available at the devture_email_template.manage route.

Web UI

Templates can be edited as HTML (they're Twig "files", after all). This bundle relies on CKEDITOR 4 as a rich-text editor.

You can load it somewhere in your webui_twig_layout_path template file with a regular <script> tag.

Alternatively, you can load it via comploader by definining it as a library named ckeditor4, like this:

Styling

This bundle relies on Bootstrap v4 for styling. Unless you install and include it (somewhere in your webui_twig_layout_path template), things would look ugly.

Additionally, you can make the pages look prettier by including a flag icon for each language somewhere in your webui_twig_layout_path template or CSS file.

Usage

Suppose you have created a template called user/registered, which contains some content like this:

To send an email using this template you'd do this:


use Symfony\Component\HttpFoundation\Request;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Devture\Bundle\EmailTemplateBundle\Helper\MessageCreator;

class UserRegistrationController extends AbstractController {

    public function register(Request $request, MessageCreator $messageCreator, \Swift_Mailer $mailer) {
        // Actually handle registration here..
        $user = $this->registerUser($request);

        $templateData = [
            'user' => $user,
        ];
        $message = $messageCreator->createMessage('user/registered', $request->getLocale(), $templateData);

        // Set these..
        $message->from($senderAddress);
        $message->to($receiverAddress);

        $mailer->send($message);
    }

}

All versions of symfony-email-template-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=8.1
symfony/yaml Version >=3.1,<7.0-dev
symfony/mailer Version >=3.1,<7.0-dev
symfony/twig-bundle Version >=3.0,<7.0-dev
html2text/html2text Version >=2.0,<5.0-dev
devture/dbal Version >=1.0,<1.3
devture/form Version >=5.0,<6.0-dev
knplabs/gaufrette Version >=0.3,<1.0-dev
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package devture/symfony-email-template-bundle contains the following files

Loading the files please wait ....