Skip to content

Releases: nette/latte

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}.
  • Added Engine::setMigrationWarnings() to help detect changes in attribute rendering.

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

Released version 3.0.18

06 Aug 03:20
@dg dg

Choose a tag to compare

  • added support for locale, affects |localDate, |number, |bytes and |sort filters
  • {import} supports arguments
  • coreParentFinder is called only for main template (BC break)
  • support for PHP 8.4

Released version 3.0.16

29 Apr 20:30
@dg dg

Choose a tag to compare

  • added filter |group & function group()
  • filter |sort accepts iterable
  • filter |sort added by & byKey
  • Filters::first() accepts iterable
  • Engine: cache-key divided into key and signature, that is stored in a lock file
  • Engine: added underscore to template class name
  • Loader::isExpired() deprecated
  • Blueprint::printClass() rewritten (BC break)