PHP Implementation of ZURB's Foundation for Email parser - Based on thampe/inky
This package compiles ZURB's template-language 'Inky' to it's html version to build responsive email-templates.
It's based on thampe/inky which unfortunately is abandoned.
Add the package in your composer.json by executing the command.
composer require frogbob/inky-php
<?php
use Frogbob\InkyPHP\InkyPHP;
$gridColumns = 12; //optional, default is 12
$additionalComponentFactories = []; //optional
$inky = new InkyPHP($gridColumns, $additionalComponentFactories);
$inky->releaseTheKraken('html...');
<?php
use Frogbob\InkyPHP\InkyPHP;
$inky = new InkyPHP();
$inky->addAlias('test', 'callout')
$inky->releaseTheKraken('<test>123</test>'); //equal to "<callout>123</callout>"
Add your own component factory, to convert custom HTML-Tags.
<?php
use Frogbob\InkyPHP\Component\ComponentFactoryInterface;
use Frogbob\InkyPHP\InkyPHP;
use PHPHtmlParser\Dom\HtmlNode;
class TestComponentFactory implements ComponentFactoryInterface
{
public function getName()
{
return 'test' // name of the html tag.
}
public function parse(HtmlNode $element, InkyPHP $inkyInstance)
{
// ...
}
}
$inky = new InkyPHP();
$inky->addComponentFactory(new TestComponentFactory());
$inky->releaseTheKraken('<test></test>');
See the LICENSE file for license info (it's the MIT license).