{"id":18626521,"url":"https://github.com/afbora/kirby-latte","last_synced_at":"2025-09-12T13:37:05.224Z","repository":{"id":81701086,"uuid":"319315062","full_name":"afbora/kirby-latte","owner":"afbora","description":"Enable Latte Template Engine for Kirby 3","archived":false,"fork":false,"pushed_at":"2020-12-07T12:39:05.000Z","size":101,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-17T08:11:40.228Z","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/afbora.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":["https://a.paddle.com/v2/click/1129/52467?link=1170"]}},"created_at":"2020-12-07T12:37:06.000Z","updated_at":"2020-12-07T12:38:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"dfd861e7-d437-4742-9216-908710fcd57a","html_url":"https://github.com/afbora/kirby-latte","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/afbora/kirby-latte","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afbora%2Fkirby-latte","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afbora%2Fkirby-latte/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afbora%2Fkirby-latte/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afbora%2Fkirby-latte/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afbora","download_url":"https://codeload.github.com/afbora/kirby-latte/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afbora%2Fkirby-latte/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274822358,"owners_count":25356507,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2024-11-07T04:38:16.083Z","updated_at":"2025-09-12T13:37:05.192Z","avatar_url":"https://github.com/afbora.png","language":"PHP","funding_links":["https://a.paddle.com/v2/click/1129/52467?link=1170"],"categories":[],"sub_categories":[],"readme":"# Kirby Latte ☕\n\n[![Source](https://img.shields.io/badge/source-afbora/kirby--latte-blue?style=flat-square)](https://github.com/afbora/kirby-latte)\n[![Download](https://img.shields.io/packagist/dt/afbora/kirby-latte?style=flat-square)](https://github.com/afbora/kirby-latte)\n[![Open Issues](https://img.shields.io/github/issues-raw/afbora/kirby-latte?style=flat-square)](https://github.com/afbora/kirby-latte)\n[![Last Commit](https://img.shields.io/github/last-commit/afbora/kirby-latte?style=flat-square)](https://github.com/afbora/kirby-latte)\n[![Release](https://img.shields.io/github/v/release/afbora/kirby-latte?style=flat-square)](https://github.com/afbora/kirby-latte)\n[![License](https://img.shields.io/github/license/afbora/kirby-latte?style=flat-square)](https://github.com/afbora/kirby-latte)\n\nThis plugin use Latte `latte/latte` 2.x package and compatible with Kirby 3. For detailed information, you can browse the [Latte documents](https://latte.nette.org/en/guide).\n\n## Installation\n\n### Installation with composer\n\n```ssh\ncomposer require afbora/kirby-latte\n```\n\n### Add as git submodule\n\n```ssh\ngit submodule add https://github.com/afbora/kirby-latte.git site/plugins/kirby-latte\n```\n\n## What is Latte?\n\nAccording to Latte documentation is:\n\n\u003e Latte is a template engine for PHP which eases your work and ensures the output is protected against vulnerabilities, such as XSS.\n\u003e - Latte is fast: it compiles templates to plain optimized PHP code.\n\u003e - Latte is secure: it is the first PHP engine introducing context-aware escaping and link checking.\n\u003e - Latte speaks your language: it has intuitive syntax and helps you to build better websites easily.\n\n## Usage\n\nIt will be sufficient to upload the latte file to the templates folder according to the template name. For ex: `/site/templates/default.latte` for default template.\n\nAll the documentation about Latte is in the [official documentation](https://latte.nette.org/en/guide).\n\n## Options\n\nThe default values of the package are:\n\n| Option | Default | Values | Description |\n|:---|:---|:---|:---|\n| afbora.kirby-latte.templatesDirectory | site/templates | (string) | Location of the templates |\n| afbora.kirby-latte.tempDirectory | site/cache/temp | (string) | Location of the cached templates |\n| afbora.kirby-latte.filters | [] | (array) | Array with the custom filters |\n| afbora.kirby-latte.functions | [] | (array) | Array with the custom functions |\n| afbora.kirby-latte.macros | [] | (array) | Array with the custom macros |\n| afbora.kirby-latte.autoRefresh | true | (boolean) | Automatically regenerates the caches |\n\nAll the values can be updated in the `config.php` file.\n\n### Templates\n\nDefault templates folder is `site/templates` directory or wherever you define your `templates` directory, but you can change this easily:\n\n```php\n'afbora.kirby-latte.templatesDirectory' =\u003e '/theme/default/templates',\n```\n\nYou can find latte templates for Kirby Starterkit in repository `/templates` folder.\n\n```\n├── layouts\n│   └── default.latte\n├── blocks\n│   └── intro.latte\n├── about.latte\n├── album.latte\n├── default.latte\n├── home.latte\n├── note.latte\n├── notes.latte\n└── photography.latte\n```\n\nAll the views generated are stored in `site/cache/temp` directory or wherever you define your `cache` directory, but you can change this easily:\n\n```php\n'afbora.kirby-latte.tempDirectory' =\u003e '/site/storage/temp',\n```\n\n### Filters\n[Filters Documentation](https://latte.nette.org/en/develop#toc-custom-filters)\n\nFilters are functions that change or format the data to a form we want. [The built-in filters which are available](https://latte.nette.org/en/filters).\n\n#### Usage filters\n\nLatte allows calling filters by using the pipe sign notation (preceding space is allowed):\n\n````php\n\u003ch1\u003e{$heading|upper}\u003c/h1\u003e\n````\n\nCustom filters can be registered this way:\n\n```php\n'afbora.kirby-latte.filters' =\u003e [\n    'shortify' =\u003e function (string $s): string {\n        return mb_substr($s, 0, 10); // shortens the text to 10 characters\n    }\n]\n```\n\nWe use it in a template like this:\n\n```php\n\u003cp\u003e{$text|shortify}\u003c/p\u003e\n\u003cp\u003e{$text|shortify:100}\u003c/p\u003e\n```\n\n### Functions\n[Functions Documentation](https://latte.nette.org/en/develop#toc-functions)\n\nIn Latte you can use all PHP functions and at the same time define your own:\n\n```php\n'afbora.kirby-latte.functions' =\u003e [\n    'random' =\u003e function (...$args) {\n        return array_rand($args);\n    }\n],\n```\n\nThe usage is then the same as when calling the PHP function:\n\n```php\n{random('apple', 'orange', 'lemon')} // prints for example: apple\n```\n\n### Macros (User-defined Tags)\n[Macros Documentation](https://latte.nette.org/en/develop#toc-user-defined-tags)\n\nLatte provides API for making your own tags. It isn't difficult at all. Tags are added in sets (a set can consist of a single tag).\n\nIn Latte you can use all PHP functions and at the same time define your own:\n\n```php\n'afbora.kirby-latte.macros' =\u003e [\n    [\n        'try', // tag name\n\t    'try {',  // PHP code replacing the opening brace\n\t    '} catch (\\Exception $e) {}' // code replacing the closing brace\n    ]\n]\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafbora%2Fkirby-latte","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafbora%2Fkirby-latte","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafbora%2Fkirby-latte/lists"}