{"id":14966394,"url":"https://github.com/yiisoft/view-twig","last_synced_at":"2026-01-12T09:39:35.158Z","repository":{"id":37103951,"uuid":"143317130","full_name":"yiisoft/view-twig","owner":"yiisoft","description":"Yii View Twig Renderer","archived":false,"fork":false,"pushed_at":"2025-12-06T22:18:04.000Z","size":198,"stargazers_count":26,"open_issues_count":1,"forks_count":9,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-12-27T06:53:26.517Z","etag":null,"topics":["hacktoberfest","template-engine","twig","yii3"],"latest_commit_sha":null,"homepage":"https://www.yiiframework.com/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yiisoft.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"open_collective":"yiisoft","github":["yiisoft"],"polar":"yiisoft"}},"created_at":"2018-08-02T16:03:23.000Z","updated_at":"2025-12-06T22:18:06.000Z","dependencies_parsed_at":"2024-11-06T06:34:56.067Z","dependency_job_id":"9f103de2-5dcb-4c2b-8be6-91c1a118b3b1","html_url":"https://github.com/yiisoft/view-twig","commit_stats":{"total_commits":120,"total_committers":20,"mean_commits":6.0,"dds":0.5833333333333333,"last_synced_commit":"d4e47e976d910f60409e9c683f171ad819ff5c31"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/yiisoft/view-twig","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fview-twig","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fview-twig/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fview-twig/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fview-twig/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yiisoft","download_url":"https://codeload.github.com/yiisoft/view-twig/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yiisoft%2Fview-twig/sbom","scorecard":{"id":1238870,"data":{"date":"2025-10-06","repo":{"name":"github.com/yiisoft/view-twig","commit":"8999c46807192ae2c1b90d0b02dc67e0229b38d2"},"scorecard":{"version":"v5.3.1-0.20251003215448-f542d69ba0cd","commit":"f542d69ba0cd01fcff1cc4395b9780f2476af14d"},"score":4.5,"checks":[{"name":"Maintained","score":2,"reason":"1 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#dangerous-workflow"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#packaging"}},{"name":"Code-Review","score":5,"reason":"Found 12/22 approved changesets -- score normalized to 5","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#binary-artifacts"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#cii-best-practices"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#vulnerabilities"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.md:0","Info: FSF or OSI recognized license: BSD 3-Clause \"New\" or \"Revised\" License: LICENSE.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: some github tokens can't read classic branch protection rules: https://github.com/ossf/scorecard-action/blob/main/docs/authentication/fine-grained-auth-token.md","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#branch-protection"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#security-policy"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 1 commits out of 26 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f542d69ba0cd01fcff1cc4395b9780f2476af14d/docs/checks.md#sast"}}]},"last_synced_at":"2025-10-18T07:53:44.915Z","repository_id":37103951,"created_at":"2025-10-18T07:53:44.915Z","updated_at":"2025-10-18T07:53:44.915Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28337740,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T06:09:07.588Z","status":"ssl_error","status_checked_at":"2026-01-12T06:05:18.301Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["hacktoberfest","template-engine","twig","yii3"],"created_at":"2024-09-24T13:36:19.175Z","updated_at":"2026-01-12T09:39:35.152Z","avatar_url":"https://github.com/yiisoft.png","language":"PHP","funding_links":["https://opencollective.com/yiisoft","https://github.com/sponsors/yiisoft","https://polar.sh/yiisoft"],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://yiisoft.github.io/docs/images/yii_logo.svg\" height=\"100px\" alt=\"Yii\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://twig.symfony.com/\" target=\"_blank\"\u003e\n        \u003cimg src=\"https://twig.symfony.com/images/twig-logo.png\" height=\"100px\" alt=\"Twig\"\u003e\n    \u003c/a\u003e\n    \u003ch1 align=\"center\"\u003eYii View Twig Renderer\u003c/h1\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n[![Latest Stable Version](https://poser.pugx.org/yiisoft/view-twig/v)](https://packagist.org/packages/yiisoft/view-twig)\n[![Total Downloads](https://poser.pugx.org/yiisoft/view-twig/downloads)](https://packagist.org/packages/yiisoft/view-twig)\n[![Build status](https://github.com/yiisoft/view-twig/actions/workflows/build.yml/badge.svg)](https://github.com/yiisoft/view-twig/actions/workflows/build.yml)\n[![Code Coverage](https://codecov.io/gh/yiisoft/view-twig/graph/badge.svg?token=V9PmRxWk9L)](https://codecov.io/gh/yiisoft/view-twig)\n[![Mutation testing badge](https://img.shields.io/endpoint?style=flat\u0026url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fview-twig%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/view-twig/master)\n[![Static analysis](https://github.com/yiisoft/view-twig/actions/workflows/static.yml/badge.svg?branch=master)](https://github.com/yiisoft/view-twig/actions/workflows/static.yml?query=branch%3Amaster)\n[![type-coverage](https://shepherd.dev/github/yiisoft/view-twig/coverage.svg)](https://shepherd.dev/github/yiisoft/view-twig)\n\nThe package is an extension of the [Yii View Rendering Library](https://github.com/yiisoft/view/). This extension\nprovides a `TwigTemplateRenderer` that would allow you to use [Twig](https://twig.symfony.com/) view template engine.\n\n## Requirements\n\n- PHP 8.1 - 8.5\n\n## Installation\n\nThe package could be installed with [Composer](https://getcomposer.org):\n\n```shell\ncomposer require yiisoft/view-twig\n```\n\n## General usage\n\nIn your application, you should specify the configuration for `Twig`\n(by default, this is `config/packages/yiisoft/view-twig/common.php`):\n\n```php\nuse Psr\\Container\\ContainerInterface;\nuse Twig\\Environment;\nuse Twig\\Loader\\FilesystemLoader;\nuse Twig\\Loader\\LoaderInterface;\nuse Yiisoft\\Aliases\\Aliases;\nuse Yiisoft\\View\\Twig\\Extensions\\YiiTwigExtension;\n\n/** @var array $params */\n\nreturn [\n    LoaderInterface::class =\u003e static fn (Aliases $aliases) =\u003e new FilesystemLoader($aliases-\u003eget('@views'))\n    Environment::class =\u003e [\n        '__construct()' =\u003e ['options' =\u003e $params['yiisoft/view-twig']['options']]\n    ],\n];\n```\n\nAnd also add the parameters for `WebView` and `Environment` in `params.php`:\n\n```php\nuse Psr\\Container\\ContainerInterface;\nuse Psr\\EventDispatcher\\EventDispatcherInterface;\nuse Twig\\Environment;\nuse Yiisoft\\Aliases\\Aliases;\nuse Yiisoft\\Definitions\\DynamicReference;\nuse Yiisoft\\Definitions\\Reference;\nuse Yiisoft\\View\\WebView;\nuse Yiisoft\\View\\Twig\\TwigTemplateRenderer;\n   \nreturn [\n    //...\n    'yiisoft/view' =\u003e [\n        'defaultExtension' =\u003e 'twig',\n        'renderers' =\u003e [\n            'twig' =\u003e Reference::to(TwigTemplateRenderer::class),\n        ],\n    ],\n    'yiisoft/view-twig' =\u003e [\n        'options' =\u003e [\n            'cache' =\u003e DynamicReference::to(static fn (Aliases $aliases) =\u003e $aliases-\u003eget('@runtime/twig')),\n            'charset' =\u003e 'utf-8',\n            'debug' =\u003e $_ENV['YII_DEBUG'],\n            //...\n        ],\n    ],\n    //...\n];\n```\n\n### Template\n\nAll variables that were in the regular template are also available in the twig template.\n\nThe default main layout of the [application template](https://github.com/yiisoft/app) will look like this:\n\n```twig\n{% do assetManager.register(['App\\\\Asset\\\\AppAsset', 'App\\\\Asset\\\\CdnFontAwesomeAsset']) %}\n{% do this.addCssFiles(assetManager.getCssFiles()) %}\n{% do this.addCssStrings(assetManager.getCssStrings()) %}\n{% do this.addJsFiles(assetManager.getJsFiles()) %}\n{% do this.addJsStrings(assetManager.getJsStrings()) %}\n{% do this.addJsVars(assetManager.getJsVars()) %}\n{{ this.beginPage()|raw }}\n\u003c!DOCTYPE html\u003e\n\u003chtml lang=\"en\"\u003e\n    \u003chead\u003e\n        \u003cmeta charset=\"utf-8\"\u003e\n        \u003cmeta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\"\u003e\n        \u003cmeta name=\"viewport\" content=\"width=device-width, initial-scale=1\"\u003e\n        \u003ctitle\u003e{{ this.getTitle() }}\u003c/title\u003e\n        {{ this.head()|raw }}\n    \u003c/head\u003e\n    \u003cbody\u003e\n    {{ this.beginBody()|raw }}\n        \u003csection class=\"hero is-fullheight is-light\"\u003e\n            \u003cdiv class=\"hero-head has-background-black\"\u003e\n                {{ get('Yiisoft\\\\Yii\\\\Bulma\\\\NavBar').widget()\n                    .brandLabel(applicationParameters.getName())\n                    .brandImage('/images/yii-logo.jpg')\n                    .options({'class': 'is-black', 'data-sticky': '', 'data-sticky-shadow': ''})\n                    .itemsOptions({'class': 'navbar-end'})\n                    .begin()|raw\n                }}\n                {{ get('Yiisoft\\\\Yii\\\\Bulma\\\\Nav').widget()\n                    .currentPath(urlMatcher.getCurrentUri() != null ? urlMatcher.getCurrentUri().getPath() : '')\n                    .items([])|raw\n                }}\n                {{ get('Yiisoft\\\\Yii\\\\Bulma\\\\NavBar').end()|raw }}\n            \u003c/div\u003e\n            \u003cdiv class=\"hero-body is-light\"\u003e\n                \u003cdiv class=\"container has-text-centered\"\u003e\n                    {{ content|raw }}\n                \u003c/div\u003e\n            \u003c/div\u003e\n            \u003cdiv class=\"hero-footer has-background-black\"\u003e\n                \u003cdiv class=\"columns is-mobile\"\u003e\n                    \u003cdiv class=\"column has-text-left has-text-light\"\u003e\n                        \u003ci class=\"fas fa-copyright fa-inverse is-hidden-mobile\"\u003e\u003c/i\u003e\n                        \u003ca class=\"is-hidden-mobile\" href=\"https://www.yiiframework.com/\" target=\"_blank\" rel=\"noopener\"\u003e\n                            {{ 'now'|date('Y') }} {{ applicationParameters.getName() }}\n                        \u003c/a\u003e\n                        \u003ca class=\"is-hidden-desktop is-size-6\" href=\"https://www.yiiframework.com/\" target=\"_blank\" rel=\"noopener\"\u003e\n                            {{ applicationParameters.getName() }}\n                        \u003c/a\u003e\n                    \u003c/div\u003e\n                    \u003cdiv class=\"column has-text-centered has-text-light is-hidden-mobile\"\u003e\u003c/div\u003e\n                    \u003cdiv class=\"column has-text-right has-text-light\"\u003e\n                        \u003cspan class=\"icon\"\u003e\n                            \u003ca href=\"https://github.com/yiisoft\" target=\"_blank\" rel=\"noopener\"\u003e\n                                \u003ci class=\"fab fa-github fa-inverse\" aria-hidden=\"true\"\u003e\u003c/i\u003e\n                            \u003c/a\u003e\n                        \u003c/span\u003e\n                        \u003cspan class=\"icon\"\u003e\n                            \u003ca href=\"https://join.slack.com/t/yii/shared_invite/enQtMzQ4MDExMDcyNTk2LTc0NDQ2ZTZhNjkzZDgwYjE4YjZlNGQxZjFmZDBjZTU3NjViMDE4ZTMxNDRkZjVlNmM1ZTA1ODVmZGUwY2U3NDA\" target=\"_blank\" rel=\"noopener\"\u003e\n                                \u003ci class=\"fab fa-slack fa-inverse \" aria-hidden=\"true\"\u003e\u003c/i\u003e\n                            \u003c/a\u003e\n                        \u003c/span\u003e\n                        \u003cspan class=\"icon\"\u003e\n                            \u003ca href=\"https://www.facebook.com/groups/yiitalk\" target=\"_blank\" rel=\"noopener\"\u003e\n                                \u003ci class=\"fab fa-facebook-f fa-inverse\" aria-hidden=\"true\"\u003e\u003c/i\u003e\n                            \u003c/a\u003e\n                        \u003c/span\u003e\n                        \u003cspan class=\"icon\"\u003e\n                            \u003ca href=\"https://twitter.com/yiiframework\" target=\"_blank\" rel=\"noopener\"\u003e\n                                \u003ci class=\"fab fa-twitter fa-inverse\" aria-hidden=\"true\"\u003e\u003c/i\u003e\n                            \u003c/a\u003e\n                        \u003c/span\u003e\n                        \u003cspan class=\"icon\"\u003e\n                            \u003ca href=\"https://t.me/yii3ru\" target=\"_blank\" rel=\"noopener\"\u003e\n                                \u003ci class=\"fab fa-telegram-plane fa-inverse\"\u003e\u003c/i\u003e\n                            \u003c/a\u003e\n                        \u003c/span\u003e\n                    \u003c/div\u003e\n                \u003c/div\u003e\n            \u003c/div\u003e\n        \u003c/section\u003e\n    {{ this.endBody()|raw }}\n    \u003c/body\u003e\n\u003c/html\u003e\n{{ this.endPage(true)|raw }}\n```\n\nAnd the view template of the main page (`site/index`) will be as follows:\n\n```twig\n{% do this.setTitle(applicationParameters.getName()) %}\n\n\u003ch1 class=\"title\"\u003eHello!\u003c/h1\u003e\n\n\u003cp class=\"subtitle\"\u003eLet's start something great with \u003cstrong\u003eYii3\u003c/strong\u003e!\u003c/p\u003e\n\n\u003cp class=\"subtitle is-italic\"\u003e\n    \u003ca href=\"https://github.com/yiisoft/docs/tree/master/guide/en\" target=\"_blank\" rel=\"noopener\"\u003e\n        Don't forget to check the guide.\n    \u003c/a\u003e\n\u003c/p\u003e\n```\n\n## Documentation\n\n- [Internals](docs/internals.md)\n\nIf you need help or have a question, the [Yii Forum](https://forum.yiiframework.com/c/yii-3-0/63) is a good place for that.\nYou may also check out other [Yii Community Resources](https://www.yiiframework.com/community).\n\n## License\n\nThe Yii View Twig Renderer is free software. It is released under the terms of the BSD License.\nPlease see [`LICENSE`](./LICENSE.md) for more information.\n\nMaintained by [Yii Software](https://www.yiiframework.com/).\n\n## Support the project\n\n[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective\u0026logoColor=7eadf1\u0026labelColor=555555)](https://opencollective.com/yiisoft)\n\n## Follow updates\n\n[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)\n[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter\u0026logoColor=1DA1F2\u0026labelColor=555555?style=flat)](https://twitter.com/yiiframework)\n[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat\u0026logo=telegram)](https://t.me/yii3en)\n[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat\u0026logo=facebook\u0026logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)\n[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat\u0026logo=slack)](https://yiiframework.com/go/slack)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fview-twig","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyiisoft%2Fview-twig","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyiisoft%2Fview-twig/lists"}