A simple php library to consume use MJML rest API

v1.0.0 2018-09-13 15:47 UTC

This package is auto-updated.

Last update: 2024-11-14 06:23:51 UTC


README

A simple php library to consume use MJML rest API

Installation

composer require juanmiguelbesada/mjml-php

How to use

<?php

use Mjml\Client;

$applicationId = '';
$secretKey = '';
$client = new Client($applicationId, $secretKey);

$mjml = '<mjml><mj-body><mj-container><mj-section><mj-column><mj-text>Hello World</mj-text></mj-column></mj-section></mj-container></mj-body></mjml>';
$message = $client->render($mjml);

$to = 'text@example.com';
$subject = 'My awesome email created with mjml';
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
mail($to, $subject, $message, $headers);