Skip to content

[Improvement] Mail: Adapter for Mustache Engine#11173

Open
fhelfer wants to merge 4 commits intoILIAS-eLearning:release_11from
fhelfer:improvement/mail/mustache-engine-adapter
Open

[Improvement] Mail: Adapter for Mustache Engine#11173
fhelfer wants to merge 4 commits intoILIAS-eLearning:release_11from
fhelfer:improvement/mail/mustache-engine-adapter

Conversation

@fhelfer
Copy link
Contributor

@fhelfer fhelfer commented Feb 25, 2026

Introduces TemplateEngineInterface and TemplateEngineFactoryInterface in the Mail component, plus a Mustache-based implementation (MustacheTemplateEngine, MustacheTemplateEngineFactory).
Mail, User, and Test now depend on these interfaces instead of Mustache_Engine or ilMustacheFactory.

Why: Direct dependencies on third-party libraries make the code harder to test, maintain, and change. An abstraction layer lets us mock the template engine in tests, swap implementations later, and keep the Mail component independent of a specific library.

ilMustacheFactory is removed. Use $DIC->mail()->templateEngineFactory() instead of mustacheFactory().

@fhelfer fhelfer added improvement php Pull requests that update Php code labels Feb 25, 2026
Copy link
Contributor

@kergomard kergomard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for the PR!

I would love it, if we could follow @mjansenDatabay suggestion, but other than that I welcome this change. (Approval for both Test and User, although I'm not sure that Test actually depends on the Mail-Template-Engine, I think it depends on an alternative template engine based on mustache, but this is for later).

Best,
@kergomard

@mjansenDatabay
Copy link
Contributor

Hi @kergomard,

we are currently working on removing the Mustache_Engine type dependency (as well as the internal ilMustacheFactory) from the code base. Instead, we switched to an adapter-based approach to decouple the system from the concrete implementation and reduce direct third-party dependencies.
In this context, we also had to adjust a few files within your components.

We hope the changes are understandable and acceptable from your perspective, and that the motivation behind this refactoring is clear. We would very much appreciate it if you could briefly review the modifications affecting your components.

Best regards,
Michael

@mjansenDatabay
Copy link
Contributor

Thanks @kergomard, lightning fast, even too fast for me! 😉

@fhelfer fhelfer requested a review from mjansenDatabay March 2, 2026 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants