MJML Compiler for PHP

1.0.0 2020-11-23 23:19 UTC

README

Description

A PHP API for MailJet's mjml transpiler.

Installation

$ composer require bryonbean/mjml

Requirements

  • The npm executable must be available in PATH.
  • The node executable must be located at /usr/local/bin/node

Usage

use Mjml\Factory;
use Mjml\Compiler;

$mjml = '
  <mjml>
    <mj-body>
      <mj-section>
        <mj-raw><p>Hello world</p></mj-raw>
      </mj-section>
    </mj-body>
  </mjml>
';

$factory = new Factory();
$compiler = new Compiler($factory);
$compiler->compile($mjml, '/path/to/my/template');

Contributing

Pull requests are welcome. For major changes please open an issue first to discuss what you would like to change.

License

MIT