maikschneider / inky
PHP 实现 ZURB 的 Email 解析器 Foundation(Inky)
1.3.6.3
2018-12-01 11:12 UTC
Requires
- php: >=5.4.0
- thesoftwarefanatics/php-html-parser: ^1.8
Requires (Dev)
- phpunit/phpunit: 4.8.*
README
不会处理问题报告和拉取请求。
Inky
A PHP Implementation of ZURB's Foundation for Email parser (Inky).
安装
您可以使用 composer 安装此扩展包
composer require maikschneider/inky
或直接将包添加到您的 composer.json
文件中。
使用方法和示例
基本使用。
<?php use Hampe\Inky\Inky; $gridColumns = 12; //optional, default is 12 $additionalComponentFactories = []; //optional $inky = new Inky($gridColumns, $additionalComponentFactories); $inky->releaseTheKraken('html...');
添加标签别名
<?php use Hampe\Inky\Inky; $inky = new Inky(); $inky->addAlias('test', 'callout') $inky->releaseTheKraken('<test>123</test>'); //equal to "<callout>123</callout>"
添加您自己的组件工厂
添加您自己的组件工厂,以转换自定义 HTML 标签。
<?php use Hampe\Inky\Component\ComponentFactoryInterface; use Hampe\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 文件(它是 MIT 许可证)。