PHP code example of gios-asu / waggle-email-maker

1. Go to this page and download the library: Download gios-asu/waggle-email-maker 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/ */

    

gios-asu / waggle-email-maker example snippets


use Waggle\Factories\EmailHandlebarsFactory;

$factory = new EmailHandlebarsFactory();
$factory->set_data( array( 'title' => 'My Awesome Email' ) );
$factory->set_css( 'h1 { font-size: 20px }' );
$factory->set_handlebars( '<h2>{{title}}</h2>' );
echo $factory->build();

use Waggle\Factories\EmailHandlebarsFactory;
use Handlebars\Handlebars;

$handlebars = new Handlebars(
    array(
      'loader' => new \Handlebars\Loader\FilesystemLoader( '/var/www/html/email-templates' ),
    )
);

$factory = new EmailHandlebarsFactory( null, $handlebars );
$factory->set_data( array( 'title' => 'My Awesome Email' ) );
$factory->set_css( 'h1 { font-size: 20px }' );
$factory->set_handlebars( 'my-email.handlebars' );
echo $factory->build();