ride/lib-mailer

Library to offer editable templates for mails in the PHP Ride framework

1.1.0 2023-09-01 06:20 UTC

This package is auto-updated.

Last update: 2024-03-30 00:37:24 UTC


README

Library to offer editable templates for mails in the PHP Ride framework.

What's In This Library

MailType

The MailType interface specifies an available mail. It can be considered an event which is triggered when certain business logic occurs. They are defined by the system/developer. Eg. A user is registered; A user is activated; An inquiry is requested; ...

MailTypeProvider

The MailTypeProvider interface is used for the data storage of mail types. Use it to retrieve a single or all mail types.

MailTemplate

The MailTemplate interface represents a preset of an outgoing mail. Recipients and variables are defined by it and are replaced by the actual values when the mail is being send.

MailTemplateProvider

The MailTemplateProvider interface is used for the data store of mail templates. Use it o retrieve a single or all mail templates.

MailHandler

The MailHandler interface is responsible for filling in the variables and sending the mail.

MailService

The MailService class is a facade to this library. You can use this class to retrieve the providers or send a mail.

Code Sample

Check the following code sample to some of the possibilities of this library.

<?php

use ride\service\MailService;

function sendMail(MailService $mailService) {
    $contentVariables = array('user' => 'My User', 'url' => 'http://www.github.com');
    $recipientVariables = array('recipient1' => 'user@domain.com', 'recipient2' => 'john@doe.com');
    $mailTemplate = 5;
    $locale = 'en';

    $mailService->sendMailTemplate($contentVariables, $recipientVariables, $mailTemplate, $locale);
}

Related Modules

Installation

You can use Composer to install this library.

composer require ride/lib-mailer