antibodies-online/bootstrap-email

A PHP port of bootstrap-email ruby package

v1.0.5 2024-06-05 09:17 UTC

This package is auto-updated.

Last update: 2024-11-10 22:20:14 UTC


README

GitHub license Packagist GitHub issues PHP Composer Test

This is a port of Bootstrap Email. Thanks to @stuyam!

Installation

To install, add it to your composer.json file:

{
  "require": {
      "antibodies-online/bootstrap-email": "master"
  }
}

or direct from packagist

composer require antibodies-online/bootstrap-email

Usage

You can use different methods to convert your boostrap-email html to an email client compatible html.

Use DomDocument

$scss = new ScssCompiler();

// Create a DOM Document
$doc = new DOMDocument('1.0', 'UTF-8');
\libxml_use_internal_errors(true);
$doc->loadHTML(mb_convert_encoding($html, 'HTML-ENTITIES', 'UTF-8'));
\libxml_clear_errors();

$converter = new Compiler($scss);
$doc = $converter->convert($doc);
$html = $doc->saveHTML();

Use Html

$scss = new ScssCompiler();
$converter = new Compiler($scss);
$html = $converter->compileHtml(<MY HTML STRING>);

Use Custom Scss

$scss = new ScssCompiler();
$scss->setScssFile(<PATH TO YOUR CUSTOM SCSS FILE);
$scss->setScssHeadFile(<PATH TO YOUR CUSTOM HEAD SCSS FILE);
$converter = new Compiler($scss);
$html = $converter->compileHtml(<MY HTML STRING>);

Run Unit-Tests

composer test

Features missing

Documentations

For full documentation, visit bootstrapemail.com

Contributing

Really appreciate bug reports. Feel free to ask for additional functionality/fields. But be aware not all feature may be implemented. A Pull Request for your Features would be amazing.

Community

For help, discussion about best practices, or any other conversation that would benefit from being searchable:

Discuss Bootstrap Email on GitHub

For PHP Port related questions, please open an issue.