frogbob / inky-php
PHP Implementation of ZURB's Foundation for Email parser - Based on thampe/inky
Installs: 5 559
Dependents: 3
Suggesters: 0
Security: 0
Stars: 2
Watchers: 2
Forks: 1
Open Issues: 0
Requires
- php: >=5.4.0
- paquettg/php-html-parser: ^2.1
This package is auto-updated.
Last update: 2024-12-09 10:37:37 UTC
README
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).