Twig Inky Extra
A Twig extension that turns Inky email markup into responsive HTML for email.
Repository Health
Technical Analysis
twig/inky-extra is an official Twig extension that adds an inky_to_html filter, processing templates written in ZURB’s Inky email markup and expanding them into the nested HTML table structures that render reliably across email clients. Inky lets you write simple, semantic tags like <row>, <columns>, and <button> instead of hand-coding fragile table layouts.
Part of the Twig ‘extra’ family, it pairs naturally with twig/cssinliner-extra to build responsive HTML emails: author with Inky, expand to tables, then inline the CSS. Under the hood it relies on lorenzo/pinky, a PHP port of the Inky templating engine.
What You Get
- An inky_to_html Twig filter that expands Inky markup into email-ready HTML tables
- Support for Inky components like rows, columns, buttons, and menus
- Seamless integration with Twig 3 and 4 as a standard extension
- A PHP implementation of the Inky engine via lorenzo/pinky
- A natural pairing with twig/cssinliner-extra for full email workflows
Common Use Cases
- Authoring responsive HTML emails with semantic Inky tags instead of raw tables
- Building transactional and marketing email templates in Symfony or standalone Twig
- Combining Inky expansion with CSS inlining to produce email-client-compatible output
Under The Hood
Architecture - The package is a single extension class, InkyExtension.php, implementing Twig’s ExtensionInterface and registering the inky_to_html filter. The filter passes Inky markup to lorenzo/pinky, which parses the semantic component tags and emits the nested HTML table structure that email clients require. Tech Stack - PHP 8.1+, Twig 3.13+/4.0, symfony/deprecation-contracts, and lorenzo/pinky as the Inky-to-HTML engine. Code Quality - Maintained in the twigphp organization with a PHPUnit suite (Tests/) and the shared CI/coding standards of the Twig extras; the codebase is deliberately tiny and focused. API Design - Very ergonomic: register the extension and apply {% apply inky_to_html %}...{% endapply %} or the inky_to_html filter to Inky markup. It pairs cleanly with the cssinliner-extra filter to form a complete email-rendering pipeline, and requires no configuration.