1. Go to this page and download the library: Download kcs/mjml 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/ */
kcs / mjml example snippets
use Mjml\Mjml;
use Mjml\Exception\RenderException;
$mjml = new Mjml(["disable_comments" => true]);
try {
// Render a MJML string and fetch the body HTML.
$email = $mjml->render('<mjml><mj-body><mj-text>Hello world!</mj-text></mj-body></mjml>');
echo $email->getBody();
// Render from a file or stream. Stream wrappers such as s3:// are supported.
$newsletter = $mjml->renderFile(__DIR__ . '/templates/newsletter.mjml');
file_put_contents(__DIR__ . '/build/newsletter.html', $newsletter->getBody());
// Inspect the default fonts shipped with MRML.
$fonts = Mjml::defaultFonts();
printf("Roboto is loaded from %s\n", $fonts['Roboto']);
// Render a template that
print_r(Mjml::defaultFonts());
sh
php -dextension=./target/release/mjml.so your-script.php
sh
php -dextension=./modules/mjml.so run-tests.php tests
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.