PHP code example of monomelodies / emily
1. Go to this page and download the library: Download monomelodies/emily library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
monomelodies / emily example snippets
use Monomelodies\Emily\Message;
$loader = new Twig\Loader\FilesystemLoader('/path/to/templates');
$twig = new Twig\Environment($loader);
// Inject the Twig_Environment to use via the Message constructor:
$msg = new Message($twig);
$msg->loadTemplate('path/to/template.html.twig');
// When done, export the Swift_Message using Monomelodies\Emily\Message::get
$swift = $msg->get();
// Now, send $swift using regular transport.
//...
$msg->setVariables(['firstname' => 'Marijn']);