Download the PHP package schumacherfm/magento-twig without Composer
On this page you can find all versions of the php package schumacherfm/magento-twig. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download schumacherfm/magento-twig
More information about schumacherfm/magento-twig
Files in schumacherfm/magento-twig
Package magento-twig
Short Description Twig template engine for Magento 2
License OSL-3.0
Informations about the package magento-twig
Magento 2 Twig Template Engine
Twig template engine for Magento2.
This template engine is meant to be used additionally to the .phtml
files and does not
provide any .twig
template file.
A use case would be if you write your first Magento2 module you can require this package and write all your template files in Twig.
Installation
-
Add dependency
-
Enable the module
- Update the database entries
Events & Configuration
The Twig template engine class dispatches two events so that you can modify Twig.
Event twig_loader
with event object loader
. You can set loader
any other class which implements
Twig_LoaderInterface
. http://twig.sensiolabs.org/doc/api.html#loaders
Event twig_init
with event object twig
. You can add here more functions, filters, tags, etc.
http://twig.sensiolabs.org/doc/advanced.html
Configuration options can be found Stores -> Settings -> Configuration -> Advanced -> Developer -> Twig.
Frontend Integration
Your template files must have the file extension .twig
to get automatically recognized.
In your layout xml files or blocks please specify the new template
Example header.phtml converted to header.twig
Example breadcrumbs.phtml converted to breadcrumbs.twig
Access helper methods
Write in your .twig
file:
Tests
@todo
Support / Contribution
Report a bug using the issue tracker or send us a pull request.
Instead of forking I can add you as a Collaborator IF you really intend to develop on this module. Just ask :-)
I am using that model: A successful Git branching model
For versioning have a look at Semantic Versioning 2.0.0
History
2.0.0
- Added Magento 2.4.0 compatibility
- Removed helper functions from
app/functions.php
since the file is no longer available in Magento 2.4 - Removed deprecated function
layoutBlock
from twig environment - Updated to twig to 3.0.*
Compatibility
- Magento >= 2
- php >= 5.4.0
License
OSL-30
Author
All versions of magento-twig with dependencies
magento/framework Version >=100.0.0
magento/module-backend Version >=100.0.0
magento/module-config Version >=100.0.0
twig/twig Version ^3.4
twig/string-extra Version ^3.4