You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+66Lines changed: 66 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -3,6 +3,71 @@ All notable changes to this project will be documented in this file.
3
3
4
4
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5
5
6
+
## [1.0.0] AST Compiler - 2026-03-22
7
+
8
+
Rewrote the parser and compiler to use an AST, based on the same lexical analysis and grammar specification as Handlebars.js. This eliminates a large class of edge cases and parsing bugs that the old regex-based approach failed to handle correctly.
9
+
10
+
### Added
11
+
- Support for nested inline partials.
12
+
- Support for closures in data and helper arguments.
13
+
-`helperMissing` and `blockHelperMissing` hooks: handle calls to unknown helpers with the same API as in Handlebars.js, replacing the old `helperResolver` option.
14
+
-`knownHelpers` compile option: tell the compiler which helpers will be available at runtime for more efficient execution (helper existence checks can be skipped).
15
+
-`assumeObjects` compile option: a subset of `strict` mode that generates optimized templates when the data inputs are known to be safe.
16
+
- Support for deprecated `{{person/firstname}}` path expressions for parity with Handlebars.js (please don't use this syntax in new code, though).
17
+
18
+
### Changed
19
+
- Custom helpers must now be passed when invoking a template (via the `helpers` runtime option key),
20
+
rather than at compile time. This is a significant optimization, since PHP files no longer have to be read and
21
+
tokenized to extract helper functions. It also enables sharing helper closures across multiple templates and renders,
22
+
and removes limitations on what they can access and do. Resolves https://github.com/zordius/lightncandy/issues/342.
23
+
- Exceptions thrown by custom helpers are no longer caught and re-thrown, so the original exception can now be caught
24
+
in your own code for easier debugging (https://github.com/devtheorem/php-handlebars/issues/13).
25
+
-`knownHelpersOnly` now works as in Handlebars.js: an exception will be thrown if the template uses a helper which is not in the `knownHelpers` list.
26
+
- Updated various error messages to align with those output by Handlebars.js.
27
+
- The `partialResolver` closure signature no longer receives a `Context` argument. Now only the partial name is passed.
28
+
29
+
### Removed
30
+
-`Options::$helpers`: pass custom helpers at runtime instead using the `helpers` key in the runtime options array (the second argument to the template closure).
31
+
-`Options::$helperResolver`: use the `helperMissing` / `blockHelperMissing` runtime helpers instead.
32
+
33
+
### Fixed
34
+
- Fatal error with deeply nested `else if` using custom helper (https://github.com/devtheorem/php-handlebars/issues/2).
35
+
- Incorrect rendering of float values (https://github.com/devtheorem/php-handlebars/issues/11).
36
+
- Conditional `@partial-block` expressions.
37
+
- Support for `@partial-block` in nested partials (https://github.com/zordius/lightncandy/issues/292).
38
+
- Ability to precompile partials and pass them at runtime (https://github.com/zordius/lightncandy/issues/341).
39
+
- Fatal error when a string parameter to a partial includes curly braces (https://github.com/zordius/lightncandy/issues/316).
40
+
- Behavior when modifying root context in a custom helper (https://github.com/zordius/lightncandy/issues/350).
41
+
- Escaping of block params and partial names.
42
+
- Inline partials defined inside a `{{#with}}` or other block leaking out of that block's scope after it closes.
43
+
- Numerous other bugs related to scoping, block params, inverted block helpers, section iteration, and depth-relative paths.
44
+
45
+
46
+
Double-check every LightnCandy and PHP Handlebars issue where I left a comment, to see if any need to be updated following the helpers changes.
@@ -164,3 +170,5 @@ with the following exceptions:
164
170
165
171
* Custom Decorators have not been implemented, as they are [deprecated in Handlebars.js](https://github.com/handlebars-lang/handlebars.js/blob/master/docs/decorators-api.md).
166
172
* The `data` and `compat` compilation options have not been implemented.
173
+
* The [runtime options to control prototype access](https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access),
174
+
along with the `lookupProperty()` helper option method have not been implemented, since they aren't relevant for PHP.
0 commit comments