PHP code example of frosh / templatemail
1. Go to this page and download the library: Download frosh/templatemail 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/ */
frosh / templatemail example snippets
namespace MyPlugin;
use FroshTemplateMail\Components\Loader\MailLoaderInterface;
use Shopware\Models\Mail\Mail;
class TwigMailLoader implements MailLoaderInterface {
private $twig;
public function __construct(\Twig_Enviroment $twig)
{
$this->twig = $twig;
}
public function canHandleExtensions(): array
{
return ['twig'];
}
public function loadMail(Mail $mail, string $templatePath, string $resolvedTemplatePath): string
{
return $this->twig->render($resolvedTemplatePath);
}
}