PHP code example of adamlc / premailer-cli-wrapper

1. Go to this page and download the library: Download adamlc/premailer-cli-wrapper 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/ */

    

adamlc / premailer-cli-wrapper example snippets




use Adamlc\Premailer\Command;
use Adamlc\Premailer\Email;

//Path to Premailer Binary
$command = new Command('/usr/bin/premailer');

//Create a new email instance, passing the Command instance
$email = new Email($command);

//Set the body of the Email
$email->setBody('<h1>Hello world</h1>');

//Get the parsed body of the email
$html = $email->getHtml();
$text = $email->getText();