Skip to content

PHP Implementation of ZURB's Foundation for Email parser - Based on thampe/inky

License

Notifications You must be signed in to change notification settings

frogbob/inky-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

InkyPHP

InkyPHP

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.

Docs

Installation

Install package

Add the package in your composer.json by executing the command.

composer require frogbob/inky-php

Usage and Examples

Basic Usage.

<?php
use Frogbob\InkyPHP\InkyPHP;

$gridColumns = 12; //optional, default is 12
$additionalComponentFactories = []; //optional
$inky = new InkyPHP($gridColumns, $additionalComponentFactories);

$inky->releaseTheKraken('html...');

Add Tag-Alias

<?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

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>');

License

See the LICENSE file for license info (it's the MIT license).

About

PHP Implementation of ZURB's Foundation for Email parser - Based on thampe/inky

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages