diff --git a/.github/version.json b/.github/version.json index ba67087..bc7a84b 100644 --- a/.github/version.json +++ b/.github/version.json @@ -1,3 +1,3 @@ { - ".": "2.1.0" + ".": "3.0.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index ede5fa6..e2fa26d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,61 @@ # Changelog +## [3.0.0](https://github.com/spiral/twig-bridge/compare/v2.1.0...v3.0.0) (2026-12-06) + + +### ⚠ BREAKING CHANGES + +* require the Spiral components instead of spiral/framework ([#54](https://github.com/spiral/twig-bridge/issues/54)) +* the package no longer installs spiral/framework. An application on the framework that does not list it in its own require adds it (composer require spiral/framework:~3.16 --no-update) before updating, otherwise the update removes it. +* `TwigEngine::getEnvironment($context)` returns the environment of that context only; set up Twig with a configurator or `TwigEngine::configure()` instead. +* make all classes final and analyse with Psalm at level 1 ([#42](https://github.com/spiral/twig-bridge/issues/42)) +* **exception:** ConfigException and SyntaxException are final. TwigEngine::__construct() takes `?Twig\Cache\CacheInterface $cache` instead of `CacheInterface|bool|null`; TwigEngine::withLoader() returns `self`, TwigEngine::get() returns `TwigView`, and the protected `EXTENSION` constant and `normalize()` method are private. TwigConfig::getExtensions() and getProcessors() are documented as `list`; TwigConfig throws ConfigException for a non-array `options`, `extensions` or `processors` entry and for an empty class name, and the bootloader throws ConfigException for an extension that is not a Twig ExtensionInterface or a processor that is not a ProcessorInterface. +* require Twig 3.31.1 and Spiral 3.16 ([#41](https://github.com/spiral/twig-bridge/issues/41)) +* with the Spiral view cache disabled, a Twig `cache` option set in the application is now applied, and compiled templates are written there. Remove the option to keep compiling in memory. +* the Twig `autoescape` option now defaults to `'name'`: `*.js.twig`/`*.json.twig` get JavaScript escaping, `*.css.twig` CSS escaping, `*.txt.twig` none. Set `autoescape` to `'html'` to restore the previous behaviour. +* TwigView::render() and renderBlock() throw Spiral\Views\Exception\RenderException instead of Twig\Error\RuntimeError, SyntaxError or LoaderError; the original Twig error is available through getPrevious(). + +### Features + +* configure every Twig environment through configurators and hooks ([#53](https://github.com/spiral/twig-bridge/issues/53)) ([9d72ebe](https://github.com/spiral/twig-bridge/commit/9d72ebe782207e4da5502c72b4743313f6191b44)), closes [#51](https://github.com/spiral/twig-bridge/issues/51) +* escape templates by file extension by default ([#37](https://github.com/spiral/twig-bridge/issues/37)) ([bc5af8f](https://github.com/spiral/twig-bridge/commit/bc5af8fe1c0126555f00728d2af680d4633c6f60)) +* provide the Twig environment as a container service ([#57](https://github.com/spiral/twig-bridge/issues/57)) ([17056a1](https://github.com/spiral/twig-bridge/commit/17056a1995cf6e2748c4b42b758f24d6b07aba62)), closes [#10](https://github.com/spiral/twig-bridge/issues/10) +* require Twig 3.31.1 and Spiral 3.16 ([#41](https://github.com/spiral/twig-bridge/issues/41)) ([4c2ae9a](https://github.com/spiral/twig-bridge/commit/4c2ae9aa321891e8819852438c157d5df856626a)) +* respect the Twig cache option when the view cache is disabled ([#40](https://github.com/spiral/twig-bridge/issues/40)) ([e98db38](https://github.com/spiral/twig-bridge/commit/e98db3863f7620534c0fcdf78e2c9b996d1fae6c)) +* ship the spiral-twig-bridge agent skill ([#56](https://github.com/spiral/twig-bridge/issues/56)) ([0f9aded](https://github.com/spiral/twig-bridge/commit/0f9aded76a99c190e2c9e8e6a358b333ddd92843)) + + +### Bug Fixes + +* apply hooks to environments created while they run and reject self-recursion ([#55](https://github.com/spiral/twig-bridge/issues/55)) ([a50fb95](https://github.com/spiral/twig-bridge/commit/a50fb9554c9c5b14b9380f52e591efff14970926)) +* **exception:** build SyntaxException from a SyntaxError without a source context ([95deee9](https://github.com/spiral/twig-bridge/commit/95deee965ec5a98f64136d0cd6bbf121d82b129e)) +* fail loudly when a Twig extension or configurator needs the views while the engine is created ([#60](https://github.com/spiral/twig-bridge/issues/60)) ([040f90a](https://github.com/spiral/twig-bridge/commit/040f90a74c9188dcc3ead915bad9dad9e17a4ebf)), closes [#58](https://github.com/spiral/twig-bridge/issues/58) [#61](https://github.com/spiral/twig-bridge/issues/61) +* keep hook and recursion state per fiber ([a50fb95](https://github.com/spiral/twig-bridge/commit/a50fb9554c9c5b14b9380f52e591efff14970926)) +* keep the view context in templates loaded while rendering ([#52](https://github.com/spiral/twig-bridge/issues/52)) ([51bfd1c](https://github.com/spiral/twig-bridge/commit/51bfd1c258b6af5e5c04db3a3ce5d8e0aa9c657a)), closes [#51](https://github.com/spiral/twig-bridge/issues/51) +* wrap errors raised while rendering into RenderException ([#38](https://github.com/spiral/twig-bridge/issues/38)) ([afd63e6](https://github.com/spiral/twig-bridge/commit/afd63e6627ae93e54b36c3ffe99fa02173b50ba7)) + + +### Documentation + +* add the 3.0 upgrade guide ([#47](https://github.com/spiral/twig-bridge/issues/47)) ([766bf0f](https://github.com/spiral/twig-bridge/commit/766bf0f9d6a12d8a9f36122dbcd9738a03594b85)) +* correct when an own Twig\Environment binding survives TwigBootloader ([ccea16a](https://github.com/spiral/twig-bridge/commit/ccea16aef55e23bf658421f57a3de56f480e0582)) +* sync the agent skill with the Spiral components, hooks and the environment service ([#59](https://github.com/spiral/twig-bridge/issues/59)) ([ccea16a](https://github.com/spiral/twig-bridge/commit/ccea16aef55e23bf658421f57a3de56f480e0582)) + + +### Code Refactoring + +* make all classes final and analyse with Psalm at level 1 ([#42](https://github.com/spiral/twig-bridge/issues/42)) ([95deee9](https://github.com/spiral/twig-bridge/commit/95deee965ec5a98f64136d0cd6bbf121d82b129e)) + + +### Build System + +* require the Spiral components instead of spiral/framework ([#54](https://github.com/spiral/twig-bridge/issues/54)) ([f6364b4](https://github.com/spiral/twig-bridge/commit/f6364b4b23639989e8892d92dd79d58cc2bf832c)) + + +### Continuous Integration + +* check the components alone with a dependency analyser, Psalm and a smoke render ([f6364b4](https://github.com/spiral/twig-bridge/commit/f6364b4b23639989e8892d92dd79d58cc2bf832c)) + ## [2.1.0](https://github.com/spiral/twig-bridge/compare/v2.0.1...v2.1.0) (2026-12-05) diff --git a/composer.json b/composer.json index e0fe79b..eb346ad 100644 --- a/composer.json +++ b/composer.json @@ -92,8 +92,7 @@ "llm/skills": true, "spiral/composer-publish-plugin": true }, - "platform": { - } + "platform": {} }, "minimum-stability": "dev", "prefer-stable": true