{"id":23418397,"url":"https://github.com/clawrock/magento2-twig-engine","last_synced_at":"2025-10-28T22:03:26.132Z","repository":{"id":56953497,"uuid":"164015984","full_name":"clawrock/magento2-twig-engine","owner":"clawrock","description":"Magento 2 Twig Template Engine","archived":false,"fork":false,"pushed_at":"2019-01-08T06:20:14.000Z","size":21,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T08:22:10.291Z","etag":null,"topics":["development","engine","magento","magento2","template","templating","twig"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/clawrock.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-01-03T19:46:20.000Z","updated_at":"2024-07-07T13:10:00.000Z","dependencies_parsed_at":"2022-08-21T08:20:39.952Z","dependency_job_id":null,"html_url":"https://github.com/clawrock/magento2-twig-engine","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/clawrock/magento2-twig-engine","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clawrock%2Fmagento2-twig-engine","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clawrock%2Fmagento2-twig-engine/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clawrock%2Fmagento2-twig-engine/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clawrock%2Fmagento2-twig-engine/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/clawrock","download_url":"https://codeload.github.com/clawrock/magento2-twig-engine/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/clawrock%2Fmagento2-twig-engine/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259401997,"owners_count":22851866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["development","engine","magento","magento2","template","templating","twig"],"created_at":"2024-12-23T00:18:33.024Z","updated_at":"2025-10-28T22:03:26.086Z","avatar_url":"https://github.com/clawrock.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Packagist](https://img.shields.io/packagist/v/clawrock/magento2-twig-engine.svg)](https://packagist.org/packages/clawrock/magento2-twig-engine)\n[![Packagist](https://img.shields.io/packagist/dt/clawrock/magento2-twig-engine.svg)](https://packagist.org/packages/clawrock/magento2-twig-engine)\n[![Build Status](https://travis-ci.org/clawrock/magento2-twig-engine.svg?branch=master)](https://travis-ci.org/clawrock/magento2-twig-engine)\n[![Coverage Status](https://coveralls.io/repos/github/clawrock/magento2-twig-engine/badge.svg)](https://coveralls.io/github/clawrock/magento2-twig-engine)\n\n# Magento 2 - Twig Template Engine\nModule implementing Twig as Magento 2 template engine. It works with default .phtml templates as fallback.\n\n## Installation\n1. Install module via composer `composer require clawrock/magento2-twig-engine`\n2. Register module `php bin/magento setup:upgrade`\n\n## Compatibility\n* Magento 2.2 - 2.3\n* PHP 7.0 - 7.2\n\n## Configuration\nThere is **no** `system.xml` file, because [Twig configuration](https://twig.symfony.com/doc/2.x/api.html#environment-options) should be only edited by developers.\n### Auto resolve option\nThis module can automatically look for twig files. For example if you want to use twig template in `Magento\\Theme\\Block\\Html\\Title` block just add file in `app/design/frontend/Vendor/theme/Magento_Theme/templates/html/title.html.twig`. If you disable auto resolve you will have to update each block template manually:\n```xml\n\u003creferenceBlock name=\"page.main.title\" template=\"Magento_Theme::html/title.html.twig\"/\u003e\n```\nAuto resolve option works the same as Magento 2 template resolver. For example if your theme is Luma and template is `Magento_Theme::html/title.phtml` it will check possible paths in following order until first existing file:\n```text\nvendor/magento/theme-frontend-luma/Magento_Theme/templates/html/title.html.twig\nvendor/magento/theme-frontend-luma/Magento_Theme/templates/html/title.twig\nvendor/magento/theme-frontend-luma/Magento_Theme/templates/html/title.phtml\n\nvendor/magento/theme-frontend-blank/Magento_Theme/templates/html/title.html.twig\nvendor/magento/theme-frontend-blank/Magento_Theme/templates/html/title.twig\nvendor/magento/theme-frontend-blank/Magento_Theme/templates/html/title.phtml\n\nvendor/magento/module-theme/view/frontend/templates/html/title.html.twig\nvendor/magento/module-theme/view/frontend/templates/html/title.twig\nvendor/magento/module-theme/view/frontend/templates/html/title.phtml\n```\n\n## Extending\n### Environment options override\n#### XML\nCreate module dependent on ClawRock_TwigEngine and override values in config.xml\n#### Programmatically\nCreate before plugin for EnvironmentFactory and modify $options argument.\n\n### Create new Twig Extension\nCreate Extension class extending AbstractExtension or implementing ExtensionInterface and register it with `etc/twig.xml`.\n\nExample: `ClawRock\\TwigEngine\\Twig\\Extension\\MagentoExtension`\n\n[See Twig documentation](https://twig.symfony.com/doc/2.x/advanced.html#creating-an-extension). \n\n**Important!**\nYou can use Magento DI in Twig Extensions. \n\n## Resources\n- [Twig](https://twig.symfony.com/)\n- [Extensions](https://github.com/twigphp/Twig-extensions)\n- [Online converter](https://phptotwig.com/)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclawrock%2Fmagento2-twig-engine","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fclawrock%2Fmagento2-twig-engine","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fclawrock%2Fmagento2-twig-engine/lists"}