PHP code example of vysokeskoly / to-inline-style-email-bundle
1. Go to this page and download the library: Download vysokeskoly/to-inline-style-email-bundle 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/ */
vysokeskoly / to-inline-style-email-bundle example snippets php
VysokeSkoly\ToInlineStyleEmailBundle\ToInlineStyleEmailBundle::class => ['all' => true],
php
public function indexAction() {
$converter = $this->get('css_to_inline_email_converter');
...
}
php
$converter = $this->get('css_to_inline_email_converter');
$html = ...; // get the HTML here
$css = ....; // get the CSS here
return $converter->inlineCSS($html, $css);
php
file_get_contents($this->container->getParameter('kernel.root_dir').'/../src/Acme/TestBundle/Resources/css/mystyle.css');
php
$converter->setHTMLByView(
'AcmeTestBundle:MyController:my_template.html.twig',
[
'param_1' => $val_of_param_1,
// ...,
'param_n' => $val_of_param_n
]
);
php
$converter->setHtml($html);
$converter->setCss($css);
return $converter->generateStyledHTML();