PHP code example of seacommerce / twig-swift-css-inliner
1. Go to this page and download the library: Download seacommerce/twig-swift-css-inliner 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/ */
seacommerce / twig-swift-css-inliner example snippets
use Seacommerce\TwigSwiftCssInliner\CssInliner;
use Twig_Environment;
use Twig_Loader_Filesystem;
$loader = new Twig_Loader_Filesystem('/Path/to/templates/folder');
$twig = new Twig_Environment($loader);
$inliner = new CssInliner($twig);
$additionalCssFile = '/path/to/additional.css';
$viewData = [
'name' => 'Sil',
'orderNbr' => 223423,
'reference' => 'ABC12',
'orderDate' => new \DateTime('2013-09-28', new \DateTimeZone('utc')),
];
$message = $inliner->createEmailFromTemplateFile('example.html.twig', $viewData, $additionalCssFile);
// send the message...