2017 © Pedro Peláez
 

library inline-email

image

1985apps/inline-email

  • Sunday, August 2, 2015
  • by prakashraman
  • Repository
  • 1 Watchers
  • 3 Stars
  • 17 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Inline Email

A Simple PHP library to generate HTML files with inline css while still using classes while writing the markup. Primarily focused on being able to create simple HTML email content, (*1)

Installation

Composer

$ composer require 1985apps/inline-email:dev-master

$ "requries" : {
    "1985apps/inline-email": "dev-master"
}

Usage

Composer

require_once "vendor/autoload.php";
$i = new InlineEmail\InlineEmail("<path/to/style.php>");

Without Composer

require_once "path/to/src/InlineEmail/InlineEmail.php";
$i = new InlineEmail\InlineEmail("<path/to/style.php>");

Files and configuration

There are 2 files that need to be setup - mail.php - File which contains the HTML - style.php - File which contains the CSS styling, (*2)

mail.php, (*3)

This file should contain the HTML structure that you want generated, (*4)

<?
    require_once "vendor/autoload.php";
    $i = InlineEmail\InlineEmail("./style.php");
?>
<div <?= $i->style(["email-container"] ?>>
    <div <?= $i->style(["bold", "red", "font-size: 12px"]) ?>>I am bold, red and 12</div>
</div>

style.php, (*5)

This file should return a associative array of classnames to css specifications, (*6)

<?
return [
    "bold" => "font-weight: bold",
    "red" => "color: red",
    "box" => "border: 1px solid red"
];

Generate HTML

Run the below command to generate a HTML file, (*7)

$ php mail.php > mail.html

Generates, (*8)

<div style="max-width: 600px">
    <div style="font-weight: bold; color: red; font-size: 12px">I am bold, red and 12
</div>

defaults.style.php

inline-email is shipped with a few standard default css classes. They are found in src/InlineEmail/defaults.style.php, (*9)

Thats it ! And we love pull requests :) Feel free to improve on our library and we will be happy to merge it into master., (*10)

The Versions

02/08 2015

dev-master

9999999-dev

  Sources   Download