Skip to content

Releases: madapaja/Madapaja.TwigModule

2.8.0

Choose a tag to compare

@koriym koriym released this 27 Aug 02:36

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.
  • FilesystemLoader receives rootPath, so cache keys no longer depend on the working directory.

Changed

  • PHP 8.2 or later is required, following bear/sunday.
  • AppPathProvider returns only the default roots that exist, so an application whose templates all sit
    beside their resources no longer needs an empty var/templates.
  • The Twig loader is now RootRelativeLoader, a FilesystemLoader subclass 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
    appDir keeps 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

Choose a tag to compare

@koriym koriym released this 17 Jan 14:22
3835eeb

What's Changed

  • Update license copyright year(s) by @github-actions[bot] in #51
  • Modify export-ignore entries in .gitattributes by @sasezaki in #52

New Contributors

Full Changelog: 2.7.0...2.7.1

2.7.0

Choose a tag to compare

@koriym koriym released this 28 Dec 18:24
7ee1b66

Add Psalm taint annotations for XSS prevention

2.6.0

Choose a tag to compare

@koriym koriym released this 23 Nov 12:03
e677a85

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/mobiledetectlib

What'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

Choose a tag to compare

@koriym koriym released this 03 Sep 14:53
36c4809

What's Changed

  • Fix mobile detection on runtime
  • Support mobiledetect/mobiledetectlib v3
  • Refactor

Full Changelog: 2.4.0...2.5.0

2.4.0

Choose a tag to compare

@koriym koriym released this 10 Jan 05:43
01334b9

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

2.3.0

Choose a tag to compare

@koriym koriym released this 30 Jan 06:14
1fbf7fe
  • PHP 8 Support
  • Support attributes
  • Bump phpunit 9

2.2.1

Choose a tag to compare

@koriym koriym released this 28 Jun 12:49
1bb996e

2.2.0

Choose a tag to compare

@koriym koriym released this 21 May 10:52
6c73406
  • Add redirect page support #34

Thanks, @kalibora san!

2.1.3

Choose a tag to compare

@koriym koriym released this 16 Apr 11:06
a525cc7
  • Update Twig version #33

Thanks @suzumaze ! 🚀