Download the PHP package mage-obsidian/module-modern-frontend-twig without Composer
On this page you can find all versions of the php package mage-obsidian/module-modern-frontend-twig. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mage-obsidian/module-modern-frontend-twig
More information about mage-obsidian/module-modern-frontend-twig
Files in mage-obsidian/module-modern-frontend-twig
Package module-modern-frontend-twig
Short Description Optional Twig template engine for MageObsidian ModernFrontend. Installing it registers a .twig engine alongside Magento's native .phtml.
License MIT
Homepage https://mage-obsidian.jeanmarcos.dev/
Informations about the package module-modern-frontend-twig
Read-only mirror. This package is developed in mage-obsidian/framework and copied here automatically. Open issues and pull requests there.
MageObsidian ModernFrontend โ Twig engine (optional)
๐ Documentation ยท ๐ Live demo ยท ๐ฌ Discussions
Optional add-on for mage-obsidian/module-modern-frontend.
Installing this module registers a .twig template engine alongside Magento's native .phtml;
removing it leaves only .phtml. Nothing else opts in โ the engine is enabled by the module's presence.
How it works
Magento dispatches a block's template by file extension
(Magento\Framework\View\Element\Template::fetchView โ TemplateEnginePool). This module adds a
twig entry to that engine map, so a block whose template ends in .twig is rendered by Twig while
every .phtml keeps using the PHP engine. .twig and .phtml coexist in the same theme, and the
theme fallback resolves .twig overrides exactly like .phtml.
What you get over phtml
- HTML auto-escaping on by default โ the main security gain; opt out per value with Twig's
raw. - Twig inheritance (
{% extends %}/{% block %}) and includes, resolved through the Magento theme fallback (useVendor_Module::path.twignames). - The MageObsidian bridge, so a
.twigmounts Vue islands like a.phtml:{{ render_vue('Vendor_Module::Component', { prop: value }) }}{{ child_html('alias') }},{{ hero_icon('check', 'solid', '24') }}{{ vite_url(path) }},{{ component_path(name) }},{{ view_file_url(fileId) }}- filters mirroring
$escaper:|escape_url,|escape_html_attr,|escape_js,|escape_css
- Block data via
{{ block.getX() }}/{{ block.getData('x') }}.
Compiled templates are cached under var/cache/twig. In developer mode templates auto-reload on
change and strict_variables / debug are enabled.
Note: this engine improves server-template ergonomics. It does not change runtime/browser performance โ that is governed by the Vue/Vite/Tailwind output.
Documentation
For more details, visit the official documentation.
All versions of module-modern-frontend-twig with dependencies
mage-obsidian/module-modern-frontend Version ^4.0
twig/twig Version ^3.12