PHP code example of gbielbarbosa / react-email-php

1. Go to this page and download the library: Download gbielbarbosa/react-email-php 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/ */

    

gbielbarbosa / react-email-php example snippets


use ReactEmail\EmailParser;

$json = '{"type":"doc","content":[{"type":"body","content":[{"type":"container"}]}]}';

$parser = new EmailParser();
$html = $parser->toHtml($json);

echo $html;

use ReactEmail\EmailParser;

// Raw JSON directly from the user's request
$rawJson = $_POST['editor_json'];

$parser = new EmailParser();
$safeJson = $parser->toJson($rawJson);

// $safeJson is now clean and ready to be stored in your database
bash
composer