PHP code example of rennokki / laravel-mjml

1. Go to this page and download the library: Download rennokki/laravel-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/ */

    

rennokki / laravel-mjml example snippets


Rennokki\LaravelMJML\LaravelMJMLServiceProvider::class,

use Rennokki\LaravelMJML\LaravelMJML;

$api = (new LaravelMJML())->setAppId('app_id')->setSecretKey('secret_key');

$html = $api->render($mjml);

$html = $api->render('<h1>MJML</h1>'); // null

$html = $api->renderWithMustache($mjml, ['message' => 'Hello World!']);
mjml
<mjml>
  <mj-body>
    <mj-section>
      <mj-column>
        <mj-text font-size="20px" color="#F45E43" font-family="helvetica">
            Hello World
        </mj-text>
      </mj-column>
    </mj-section>
  </mj-body>
</mjml>