kristuff/phtemail

PHP Html Email Builder

v0.2 2020-06-03 11:07 UTC

This package is auto-updated.

Last update: 2024-11-15 01:52:34 UTC


README

Php Html email builder

Scrutinizer Code Quality Build Status Latest Stable Version License

Wanting to send html emails from some apps, I have used some times email templates edited by hand, meaning needing to look into boring html table structure from an extisting template, hard code the email content, or place some tags to be replaced later with real content by the code that needs to retreive the template, search replace tags, etc... That's so boring

Kristuff\Phtemail lets you create your template on the fly. Then, you are free to save it or send it immediately. The library comes with a centered layout, custom html elements for layout and email content, predefined styles, and methods / ways to customize the email as you need.

Requirments

  • PHP >= 7.1
  • Composer (for install)

Install

  • Install with composer:

    $  composer require kristuff/phtemail
    
  • Or deploy in your project (in composer.json):

    {
        ...
        "require": {
            "kristuff/phtemail": ">=0.1-stable"
        }
    }
    

Sample

Basic sample:

<?php
require_once '../vendor/autoload.php';

use Kristuff\Phtemail\HtmlEmailBuilder;
use Kristuff\Phtemail\HtmlElements;

// Create a new instance an HtmlEmailBuilder 
$builder = new HtmlEmailBuilder();

//todo

// Get the generated email
email = $builder->getHtml();

Licence

MIT