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
nullvalues are now dropped instead of rendering as empty strings. - Boolean attributes: Attributes like
checkedordisabledrender conditionally based on truthy/falsey values. - Array support:
classandstyleattributes 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:elseifsupport. - Added nullsafe filter operator
?|(e.g.,{$var?|upper}). - Added
|togglefilter 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
strictTypesis now enabled by default.- Using
$thisand$__*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.