twin-elements/message

Helper in composing the message

v1.3.2 2022-07-29 11:20 UTC

This package is auto-updated.

Last update: 2024-04-29 04:59:19 UTC


README

##Installation

###Step 1: Download the Bundle

composer require twin-elements/message

###Step 2: If you do not use TwinElements/AdminBundle, enable the service

#config/services.yaml
services:
    TwinElements\Component\Message\MessageBuilderFactory: ~

###Usage

public function index(
        MessageBuilderFactory $messageBuilderFactory,
        MailerInterface       $mailer
    )
    {
        $message = ($messageBuilderFactory->createMessageBuilder()->getMessage(
            'Subject',
            ['key' => 'value'],
            'email_template_path.html.twig'
        ))
            ->addTo('email@email.com');
        
            $mailer->send($message);          
    }