Releases: madapaja/Madapaja.TwigModule
Release list
2.8.0
Added
TwigProdModule: compiles templates in the build phase and serves them read-only from{buildDir}/twig.
The sources are still resolved on every load to build the cache key, so an archive carries both.FilesystemLoaderreceivesrootPath, so cache keys no longer depend on the working directory.
Changed
- PHP 8.2 or later is required, following
bear/sunday. AppPathProviderreturns only the default roots that exist, so an application whose templates all sit
beside their resources no longer needs an emptyvar/templates.- The Twig loader is now
RootRelativeLoader, aFilesystemLoadersubclass that reports template paths
relative to the root path. Compiled artifacts no longer embed the absolute path of the machine that
compiled them, so a Twig error in production names the deployed template. A template root bound outside
appDirkeeps its absolute path, in the cache key as much as in the reported path, and stays unportable.
Migration
Install TwigProdModule in the production context module, the one chained over the application module:
// src/Module/ProdModule.php
$this->install(new TwigProdModule());An application that pins TwigOptions itself keeps managing its own cache, so the override has to go:
-$options = ['debug' => false, 'cache' => $this->appMeta->appDir . '/var/tmp/twig'];
-$this->bind()->annotatedWith(TwigOptions::class)->toInstance($options);
+$this->install(new TwigProdModule());Serving no longer compiles: a missing artifact raises Exception\TemplateNotCompiled. bear/package has to
run the twig compile step during bin/bear.compile.
An application that pins its own template paths has to derive them from AbstractAppMeta::$appDir through a
provider of its own. A literal path list is bound by instance, so the build machine's absolute paths are
written into the compiled DI script and the archive looks for directories that are not in it.
2.7.1
2.7.0
2.6.0
2.6.0
Twig 2.x is dropped
Currently, PHP 8.4 and Twig 2.x are not compatible, so Twig 2.x support is dropped. If Twig 2.x is supported by PHP 8.4 in the future, it may be restored.
MobileTwigModule needs extra installation
In order to use the MobileTwigModule, it is necessary to install mobiledetect/mobiledetectlib as follows.
Please execute the following command in your project root.
composer require mobiledetect/mobiledetectlibWhat's Changed
- Enable PHP 8.4, Drop Twig 2.x and Windows test support by @koriym in #47
- The need for MobileTwigModule has decreased, so we will make it an optional install by @koriym in #48
Full Changelog: 2.5.1...2.6.0
2.5.0
What's Changed
- Fix mobile detection on runtime
- Support mobiledetect/mobiledetectlib v3
- Refactor
Full Changelog: 2.4.0...2.5.0
2.4.0
What's Changed
- Twig v3 support by @koriym in #39
- Update license copyright year(s) by @github-actions in #41
- Refactor Attribute by @koriym in #42
- Drop support for PHP 7.x and optimize for PHP 8 by @koriym in #43
- Soothe psalm by @koriym in #44
New Contributors
- @github-actions made their first contribution in #41
Full Changelog: 2.3.0...2.4.0