2017 © Pedro Peláez
 

library laravel-email-templates

Laravel 5 database driven email templating

image

jdtsoftware/laravel-email-templates

Laravel 5 database driven email templating

  • Sunday, June 10, 2018
  • by tjmartin69
  • Repository
  • 5 Watchers
  • 20 Stars
  • 1,017 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 8 Forks
  • 2 Open issues
  • 13 Versions
  • 32 % Grown

The README.md

StyleCI, (*1)

Laravel Email Templates

Database driven email templates for >= Laravel 5.4 and PHP 7., (*2)

Configuration

First register the service provider in config/app.php:, (*3)

'providers' => [
    # ...
    JDT\LaravelEmailTemplates\ServiceProvider::class,
],

Then, in the same file, add the facade to the aliases config:, (*4)

'aliases' => [
    # ...
    'EmailTemplate' => JDT\LaravelEmailTemplates\Facades\EmailTemplates::class,
]

Next, run the migrations:, (*5)

$ php artisan migrate

This will set up 2 tables; email_template and email_layout., (*6)

Usage

The package is built in such a way that it plays nicely with the existing Laravel Mailer functionality., (*7)

Given a template existing in the above table with the handle 'registration', email can be sent simply as below:, (*8)

$mail = \EmailTemplate::fetch('registration', ['name' => 'Jon']);

\Mail::to('foo@bar.com', $mail);

You can of course pass the language to translate the chosen email, providing you have created an email for that handle/language combination., (*9)

$mail = \EmailTemplate::fetch('registration', ['name' => 'Jon'], 'es');

\Mail::to('foo@bar.com', $mail);

This package doesn't rely on a templating engine such as Blade or Twig to handle any of the email messages, but does provide it's own view class adhering to Laravel contracts., (*10)

This means that you can pass data to the email just as you would any other view, without having to worry about the choice of templating package you use elsewhere in your project., (*11)

$mail = \EmailTemplate::fetch('registration', ['first_name' => 'Jon']);

$mail->with('last_name', 'Braud');

$mail->with([
    'verify_url'=> 'https:/....',
    'signup_time' => \Carbon\Carbon::now()->toDateTimeString()
]);

\Mail::to('foo@bar.com', $mail);

The Versions

10/06 2018

dev-master

9999999-dev

Laravel 5 database driven email templating

  Sources   Download

The Requires

 

by Jon Braud

11/05 2017

v0.3.2

0.3.2.0

Laravel 5 database driven email templating

  Sources   Download

The Requires

 

by Jon Braud

11/05 2017

dev-encoding_fix

dev-encoding_fix

Laravel 5 database driven email templating

  Sources   Download

The Requires

 

by Jon Braud

30/04 2017

v0.3.1

0.3.1.0

Laravel 5 database driven email templating

  Sources   Download

The Requires

 

by Jon Braud

30/04 2017

v0.3

0.3.0.0

Laravel 5 database driven email templating

  Sources   Download

The Requires

 

by Jon Braud

30/04 2017

dev-caching_support

dev-caching_support

Laravel 5 database driven email templating

  Sources   Download

The Requires

 

by Jon Braud

30/04 2017

dev-analysis-8wQpK9

dev-analysis-8wQpK9

Laravel 5 database driven email templating

  Sources   Download

The Requires

 

by Jon Braud

05/04 2017

v0.2.2

0.2.2.0

Laravel 5 database driven email templating

  Sources   Download

The Requires

 

by Jon Braud

04/04 2017

v0.2.1

0.2.1.0

Laravel 5 database driven email templating

  Sources   Download

by Jon Braud

30/03 2017

dev-analysis-XNwaE4

dev-analysis-XNwaE4

Laravel 5 database driven email templating

  Sources   Download

by Jon Braud

28/03 2017

dev-analysis-XpWQW6

dev-analysis-XpWQW6

Laravel 5 database driven email templating

  Sources   Download

by Jon Braud

28/03 2017

v0.2

0.2.0.0

Laravel 5 database driven email templating

  Sources   Download

by Jon Braud

23/03 2017

v0.1

0.1.0.0

Laravel 5 database driven email templating

  Sources   Download

by Jon Braud