antibodies-online / bootstrap-email
A PHP port of bootstrap-email ruby package
Installs: 2 558
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 3
Open Issues: 0
Language:HTML
Requires
- php: ^7.1 || ^8.0
- ext-dom: *
- scssphp/scssphp: ^v1.5.0
- tijsverkoyen/css-to-inline-styles: ^2.2
- twig/twig: ^v1.0 || ^v2.0 || ^v3.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
README
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
- Add Stack https://bootstrapemail.com/docs/stack
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.