{"id":13721559,"url":"https://github.com/pug-php/pug-yii2","last_synced_at":"2025-10-26T15:30:29.771Z","repository":{"id":52264891,"uuid":"113600110","full_name":"pug-php/pug-yii2","owner":"pug-php","description":"Pug Yii2 adapter","archived":false,"fork":false,"pushed_at":"2021-05-02T18:13:39.000Z","size":62,"stargazers_count":7,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-30T05:25:57.530Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pug-php.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-12-08T17:28:06.000Z","updated_at":"2023-09-21T20:06:39.000Z","dependencies_parsed_at":"2022-09-12T04:21:58.152Z","dependency_job_id":null,"html_url":"https://github.com/pug-php/pug-yii2","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pug-php%2Fpug-yii2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pug-php%2Fpug-yii2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pug-php%2Fpug-yii2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pug-php%2Fpug-yii2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pug-php","download_url":"https://codeload.github.com/pug-php/pug-yii2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238347904,"owners_count":19457012,"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":[],"created_at":"2024-08-03T01:01:18.620Z","updated_at":"2025-10-26T15:30:28.363Z","avatar_url":"https://github.com/pug-php.png","language":"PHP","funding_links":[],"categories":["Tools"],"sub_categories":["Frameworks"],"readme":"Yii 2 Pug (ex Jade) extension\n===============================\n\nThis extension provides a view renderer for [Pug](https://pugjs.org/) templates\nfor [Yii framework 2.0](http://www.yiiframework.com/) applications.\n\n[![License](https://poser.pugx.org/pug/yii2/license.svg)](https://packagist.org/packages/pug/yii2)\n[![Latest Stable Version](https://poser.pugx.org/pug/yii2/v/stable.svg)](https://packagist.org/packages/pug/yii2)\n[![Travis CI Build Status](https://travis-ci.org/pug-php/pug-yii2.svg)](https://travis-ci.org/pug-php/pug-yii2)\n[![Test Coverage](https://codeclimate.com/github/pug-php/pug-yii2/badges/coverage.svg)](https://codeclimate.com/github/pug-php/pug-yii2/coverage)\n[![Issue Count](https://codeclimate.com/github/pug-php/pug-yii2/badges/issue_count.svg)](https://codeclimate.com/github/pug-php/pug-yii2)\n[![StyleCI](https://styleci.io/repos/113600110/shield?branch=master)](https://styleci.io/repos/113600110)\n\nSupport\n-------\n* [GutHub issues](https://github.com/pug-php/pug-yii2/issues)\n\n\nInstallation\n------------\n\nThe preferred way to install this extension is through [composer](https://getcomposer.org/).\n\nEither run\n\n```bash\ncomposer require pug/yii2\n```\n\nor add\n\n```\n\"pug/yii2\": \"^1.0\",\n```\n\nto the `require` section of your `composer.json` file.\n\n\nConfigure\n---------\n```php\n\u003c?php\n\nreturn [\n  // ...\n  'components' =\u003e [\n    // ...\n    'view' =\u003e [\n      // ...\n      'renderers' =\u003e [\n        'pug' =\u003e 'Pug\\\\Yii\\\\ViewRenderer',\n      ],\n    ],\n  ],\n];\n```\n\nYou can also use other pug renderer like\n[phug](https://www.phug-lang.com) or\n[tale-pug](https://github.com/Talesoft/tale-pug)\n```php\n\u003c?php\n\nreturn [\n  // ...\n  'components' =\u003e [\n    // ...\n    'view' =\u003e [\n      // ...\n      'renderers' =\u003e [\n        'pug' =\u003e [\n          'class'    =\u003e 'Pug\\\\Yii\\\\ViewRenderer',\n          'renderer' =\u003e 'Phug\\\\Renderer',\n        ],\n      ],\n    ],\n  ],\n];\n```\nPhug and Pug-php (the default renderer) are automatically installed\nwhen you install the last version of `pug/yii2`, for other pug renderer,\nreplace the renderer class and include it.\n\nFor example, for Tale-pug, use `composer require talesoft/tale-pug`\nthen replace `'Tale\\\\Pug\\\\Renderer'` with `'Tale\\\\Pug\\\\Renderer'`\nin the config example above.\n\n### Cache path and View path\n\nBy default, this extension uses `'@runtime/pug/cache'` to store compiled\ntemplates, and looks in `'@app/views'` to find the templates to compile.\n\nYou can change this, by specifying `cachePath` and/or `viewPath` in the\nconfiguration, for example:\n\n```\nreturn [\n  // ...\n  'components' =\u003e [\n    // ...\n    'view' =\u003e [\n      // ...\n      'renderers' =\u003e [\n        'pug' =\u003e [\n          'class'     =\u003e 'Pug\\\\Yii\\\\ViewRenderer',\n          'cachePath' =\u003e '@app/runtime/Pugcache',\n          'viewPath'  =\u003e '@app/themes/dark/templates/views',\n        ],\n      ],\n    ],\n  ],\n];\n```\n\n`pug/yii` provide 2 global variables: `app` (`Yii::$app`) and `view` (view\npath given to `-\u003erender()` in your controller). It imply that:\n- If you set **app** or **view** shared variables, they will be erased by\nthose system values.\n- If you pass **app** or **view** locals to the `-\u003erender()` method they\nwill have the precedence on system values.\n\nTo avoid such name conflict, you can pack into on object and store in a\nshared variable with a name you chose:\n```php\nreturn [\n  // ...\n  'components' =\u003e [\n    // ...\n    'view' =\u003e [\n      // ...\n      'renderers' =\u003e [\n        'pug' =\u003e [\n          'class'           =\u003e 'Pug\\\\Yii\\\\ViewRenderer',\n          // ...\n          'systemVariable'  =\u003e '_yii',\n        ],\n      ],\n    ],\n  ],\n];\n```\nWith this config, **app** and **view** are no longer reserved names\n(can be used for your own locals or shared variables),\nonly **_yii** is, and so you can get app and view like this:\n```pug\nh1=_yii.view.defaultExtension\np=_yii.app.version\n```\nOr if you set the `expressionLanguage` option to `\"php\"`:\n```pug\nh1=$_yii-\u003eview-\u003edefaultExtension\np=$_yii-\u003eapp-\u003egetVersion()\n```\n\nCredits\n-------\n\nThis solution merge both project\n[rmrevin/yii2-pug](https://github.com/rmrevin/yii2-pug)\n(original fork that support pug-php 2) and\n[jacmoe/yii2-tale-pug](https://github.com/jacmoe/yii2-tale-pug)\n(tale-pug and tale-jade Yii2 solution)\nand finally bring support for pug-php 3 and phug engines.\n ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpug-php%2Fpug-yii2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpug-php%2Fpug-yii2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpug-php%2Fpug-yii2/lists"}