PHP Implementation of ZURB's Foundation for Email parser (Inky)

Maintainers

Details

github.com/incentfit/inky

Source

Installs: 43 390

Dependents: 2

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 25

1.3.6.5 2019-09-04 22:58 UTC

This package is not auto-updated.

Last update: 2024-11-07 22:36:03 UTC


README

A PHP Implementation of ZURB's Foundation for Email parser (Inky).

Installation

You can install this bundle using composer

composer require incentfit/inky

or add the package to your composer.json file directly.

Usage and Examples

Basic Usage.

<?php
use IncentFit\Inky\Inky;

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

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

Add Tag-Alias

<?php
use IncentFit\Inky\Inky;

$inky = new Inky();
$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 IncentFit\Inky\Component\ComponentFactoryInterface;
use IncentFit\Inky\Inky;
use PHPHtmlParser\Dom\HtmlNode;

class TestComponentFactory implements ComponentFactoryInterface
{
    public function getName()
    {
        return 'test' // name of the html tag.
    }

    public function parse(HtmlNode $element, Inky $inkyInstance)
    {
        // ...
    }
}

$inky = new Inky();
$inky->addComponentFactory(new TestComponentFactory());
$inky->releaseTheKraken('<test></test>');

License

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