Ride: Mailer Library
Library to offer editable templates for mails in the PHP Ride framework., (*1)
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; ..., (*2)
MailTypeProvider
The MailTypeProvider interface is used for the data storage of mail types.
Use it to retrieve a single or all mail types., (*3)
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., (*4)
MailTemplateProvider
The MailTemplateProvider interface is used for the data store of mail templates.
Use it o retrieve a single or all mail templates., (*5)
MailHandler
The MailHandler interface is responsible for filling in the variables and sending the mail., (*6)
MailService
The MailService class is a facade to this library.
You can use this class to retrieve the providers or send a mail., (*7)
Code Sample
Check the following code sample to some of the possibilities of this library., (*8)
<?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);
}
Installation
You can use Composer to install this library., (*9)
composer require ride/lib-mailer