# Latte

> PHP template engine with context-sensitive escaping

Source: https://talira.ai/catalog/latte-k93t7svg
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / templating](https://talira.ai/categories/libraries/templating), [languages / php](https://talira.ai/categories/languages/php)
- Licence: BSD-3-Clause OR GPL-2.0-only OR GPL-3.0-only[^1][^2]
- Pricing: Free and open source[^1]
- Pricing notes: Free and open source (BSD-3-Clause, or GPL-2.0 or GPL-3.0).
- Free tier: yes[^1]
- Backed by: [Nette](https://talira.ai/orgs/nette.md)

Latte is a templating engine for PHP from the [Nette](https://talira.ai/catalog/nette-framework-3fc706xv.md) project, usable on its own or in Nette Framework. Its expressions are written as in PHP, with one {...} delimiter, and it understands the HTML around them, so it escapes each variable for its context (text, attributes, unquoted attributes or JavaScript) to stop cross-site scripting. Paired tags can be written as n:attributes on an HTML element, templates use layouts and inheritance, and a sandbox mode limits the tags, filters and functions templates from untrusted authors can use. Templates compile to plain PHP and recompile when the source changes, and a Tracy panel shows which templates and variables a page rendered. Install it from Packagist as latte/latte.

## Links

- Website: https://latte.nette.org/
- GitHub: https://github.com/nette/latte

## Problems it solves

- a PHP template engine that escapes output correctly in attributes and scripts
- let users edit page templates in my PHP app without giving them full PHP
- write PHP templates without learning a new syntax like Twig's

## Features

- context-sensitive escaping against XSS
- PHP expression syntax with one delimiter
- n:attributes for paired tags
- layouts and template inheritance
- sandbox mode for untrusted templates
- compiles to plain PHP
- Tracy debugger panel
- PhpStorm and NetBeans support

## Trust

Overall: 0.62 out of 1.
Signals: maintenance 1.00, adoption 0.62, momentum 0.28, community 0.71, backing 0.30, extensibility 0.00.

- last commit 6 days ago
- 91 commits in the last 90 days
- latest release v3.1.10 7 days ago
- 1.3k GitHub stars
- 60 contributors
- accepts sponsorship (Github)
- backed by Nette

## Alternatives

- [Twig](https://talira.ai/catalog/twig-gty3db20.md): The flexible, fast, and secure template engine for PHP
- [Smarty (PHP)](https://talira.ai/catalog/smarty-php-6ts7hh16.md): The compiling template engine for PHP

## Sources

[^1]: https://github.com/nette/latte/blob/master/license.md (checked 28 Nov 2026)
[^2]: https://github.com/nette/latte/blob/master/composer.json (checked 28 Nov 2026)
