Skip to content

Releases: nette/latte

Released version 3.0.26

25 Feb 00:02
@dg dg

Choose a tag to compare

  • Feature class with setFeature()/hasFeature() – a unified way to toggle engine capabilities. Existing methods like setStrictTypes() and setStrictParsing() now delegate to this system, so you can use either style. New features can be added without cluttering the Engine API.
  • setCacheDirectory() replaces the old setTempDirectory() – because "temp" was too easily confused with "template". The old method still works but consider it deprecated.
  • Fixed ! operator priority – the logical NOT operator was incorrectly placed at the same precedence level as bitwise NOT and type casts, above instanceof. It now correctly sits below instanceof, matching PHP's actual operator precedence.

Released version 3.1.2

25 Feb 01:37
@dg dg

Choose a tag to compare

Latte 3.1.2 introduces a clean feature flag system, tightens up the compiler API with two breaking changes, and brings the codebase under stricter static analysis. If you're extending the compiler, pay attention to the TokenStream and custom function changes below.

  • Feature enum with setFeature()/hasFeature() – a unified way to toggle engine capabilities like StrictTypes, StrictParsing, and MigrationWarnings. The old methods (setStrictTypes(), setStrictParsing(), setMigrationWarnings()) still work but are now deprecated in favor of the enum-based API.
  • setCacheDirectory() replaces the old setTempDirectory() – because "temp" was way too easily confused with "template". The old method still works but is deprecated.
  • LinterExtension now correctly validates ::class expressions – previously {=UnknownClass::class} slipped through validation because it was handled as a class constant instead of a class type check.
  • Added missing native type declarations across the codebase.
  • Improved phpDoc types and descriptions.
  • Unified declare(strict_types=1) to single-line format.

Released version 3.1.1

18 Dec 22:42
@dg dg

Choose a tag to compare

  • added LinterExtension for validating filters, functions, classes and methods
  • linter: improved finding files, excludes temp, vendor, node_modules
  • support every argument syntax for clone() in PHP 8.5
  • added CustomFunctionCallNode for custom functions
  • refactor: decentralize operator precedence to individual nodes
  • *CallableNode replaced with solution with VariadicPlaceholder (BC break)
  • ErrorSuppressNode & NotNode merged into UnaryOpNode (BC break)
  • deprecated PrintContext::infixOp(), prefixOp(), postfixOp() (BC break)
  • fixed operator ! priority

Release version 3.0.25

28 Nov 17:39
@dg dg

Choose a tag to compare

  • Escaper: supports converting HTML => TEXT
  • Escaper: fixed converting between HTML/ATTR <=> HTML
  • added ModifierNode::removeFilter()
  • linter: added assets extension

Released version 3.1.0

26 Nov 18:46
@dg dg

Choose a tag to compare

This major release introduces Smart HTML Attributes, strict_types by default, and several syntax improvements. It requires PHP 8.2+.

Smart HTML Attributes

  • Null values: Attributes with null values are now dropped instead of rendering as empty strings.
  • Boolean attributes: Attributes like checked or disabled render conditionally based on truthy/falsey values.
  • Array support: class and style attributes now accept arrays (e.g., class="{[active: $cond]}").
  • Data attributes: data-* attributes automatically JSON-serialize non-string values (arrays, objects, booleans).
  • Aria attributes: aria-* attributes render boolean values as "true"/"false".
  • Type checking: Passing invalid types (arrays, objects) to standard attributes now triggers a warning and omits the attribute.

New Features

  • Added n:elseif support.
  • Added nullsafe filter operator ?| (e.g., {$var?|upper}).
  • Added |toggle filter for manual boolean attribute control.
  • Support for unquoted n-attribute syntax: n:if={$cond}.

Breaking Changes & Deprecations

  • strictTypes is now enabled by default.
  • Using $this and $__* variables in templates is deprecated.
  • The undefined unsafe operator ??-> is deprecated (use ?->).
  • Global constants should now be prefixed with a slash (e.g., \PHP_VERSION).
  • Engine::addFilterLoader() is deprecated.

Released version 3.0.24

30 Oct 21:41
@dg dg

Choose a tag to compare

  • Released version 3.0.24
  • support for PHP 8.5
  • added support for pipe operator in PHP 8.5
  • added support for new deref without parens in PHP 8.4
  • added Engine::setSyntax() to set default syntax (#359)
  • refactor: moved script tag quote validation from PrintNode to compiler pass
  • Tag parser: checks octal sequence overflow
  • Engine::getCacheKey() reflects strictTypes & strictParsing, ignores filemtime of extensions
  • ElementNode::getAttribute() uses case-insensitive comparison in XML
  • NAttrNode: renamed temporary variables not to collide with n:snippet

Released version 3.0.22

16 Jul 18:57
@dg dg

Choose a tag to compare

  • TagParser: allowed |filter() and bitwise OR
  • PrintContext::format() parenthesizes %node if it has lower precedence than the assignment operator
  • PrintContent: refactoring and updated operator precedence and associativity table
  • Cache::generateFileName() file name always contains 'latte--'
  • added /** Generated by Latte */ comment
  • n:else: fixed when there are multiple TextNode
  • PrintNode moved to Latte\Compiler\Nodes
  • Nodes: removes null nodes after traversal

Released version 3.0.22

24 Jun 15:45
@dg dg

Choose a tag to compare

  • added function hasTemplate()
  • added |firstLower
  • added NodeTraverser::RemoveNode constant #396
  • improved block/template dynamic name checking
  • optimized global function calls

Released version 3.0.21

17 May 05:47
@dg dg

Choose a tag to compare

  • tag name can end with ? like {foo?}
  • support property hooks in template params (#395)
  • |number with pattern requires locale #390
  • removed workaround against mXSS vulnerability
  • Engine: caching moved to Cache
  • LattePanel: convert templates to Latte-like syntax

Released version 3.0.20

06 Oct 23:36
@dg dg

Choose a tag to compare

  • {default} is evaluated lazily
  • |localDate respects the time zone set in PHP #380
  • added |filter
  • FileLoader: fixed path normalization for phar and absolute paths #378
  • TagParser: allow trailing comma in |filter(...)
  • TranslatorExtension: translate() can return \Stringable #372
  • CachingIterator::__get() does not return a reference