2017 © Pedro Peláez
 

library email_templates

Utility package to parse templates for emails easily

image

strack/email_templates

Utility package to parse templates for emails easily

  • Wednesday, June 13, 2018
  • by weijer
  • Repository
  • 1 Watchers
  • 0 Stars
  • 6 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

MKcom.Utility.EmailTemplates

Simple class for parsing email templates written in HTML with variable data., (*1)

Installation

via Composer

Note: This package is not registered on packagist.org., (*2)

$ composer config repositories.mkcom/utility-emailtemplates vcs git@github.com:mkeitsch/utility-emailtemplates.git

$ composer require mkcom/utility-emailtemplates

Using EmailTemplates

Create a simple HTML file for an email template., (*3)

Use subject instead of title for your email subject in the head section., (*4)

Double curly braces {{}} are used for defining variables. You can use it wherever you want in the template. I recommend using camelCased variable names. These are tested. But you can use and test whatever you want., (*5)

<!DOCTYPE html>
<html>
    <head>
        <subject>
            My Subject For A New Email
        </subject>
    </head>
    <body>
        Hey {{firstName}},

        this is a my email template.

        Greetings {{senderName}} :)
    </body>
</html>

Create a new email template by just instantiating the EmailTemplate class with the location of the template file and an array of variables that should be inserted as arguments., (*6)

$emailTemplate = new EmailTemplate(__DIR__.'/Templates/myEmailTemplate.html', array(
    'firstName' => 'John',
    'senderName' => 'Max',
));

$emailBody = $emailTemplate->getBody();
$emailSubject = $emailTemplate->getSubject();

Perfect Neos Flow Integration

Works perfectly with Neos Flow and the resource://-Wrapper:, (*7)

$emailTemplate = new EmailTemplate('resource://Acme.Demo/Private/Email/Template/FooBar.html', array(...));

The Versions

13/06 2018

dev-master

9999999-dev https://github.com/mkeitsch/utility-emailtemplates

Utility package to parse templates for emails easily

  Sources   Download

MIT

The Development Requires

13/06 2018

1.0.2

1.0.2.0 https://github.com/mkeitsch/utility-emailtemplates

Utility package to parse templates for emails easily

  Sources   Download

MIT

The Development Requires

14/03 2017

dev-develop

dev-develop https://github.com/mkeitsch/utility-emailtemplates

Utility package to parse templates for emails easily

  Sources   Download

MIT

The Development Requires

14/03 2017

1.0.1

1.0.1.0 https://github.com/mkeitsch/utility-emailtemplates

Utility package to parse templates for emails easily

  Sources   Download

MIT

The Development Requires

31/10 2016

1.0

1.0.0.0 https://github.com/mkeitsch/utility-emailtemplates

Utility package to parse templates for emails easily

  Sources   Download

MIT

The Development Requires

04/10 2016

0.1

0.1.0.0

Utility package to parse templates for emails easily

  Sources   Download