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-10-29 06:31:04 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);          
    }