Modules are installed with Composer used as a library
- Created
- Decided
- Versions
- History
Context
Modules come from two sources: bundled modules, shipped inside the binary as part of the panel's own codebase, per
ADR-0009, and external modules, installed
alongside it. External modules are Composer packages with dependencies of their own,
some of which the panel already provides. The panel depends on composer/composer, added for installing them.
Decision
External modules are Composer packages of type tgp-module, installed into a separate Composer project in the
modules directory, with its own composer.json and vendor/. The panel drives Composer as a PHP library rather than
running it as a standalone tool, and includes the modules autoloader alongside its own.
Alternatives
Composer as a standalone tool. Using it as a library instead gives full programmatic control over repository resolution and installation.
No other way of installing modules was weighed.
Consequences
Easier:
- The panel will have full programmatic control over resolving repositories and installing modules.
- External modules will declare their dependencies as ordinary Composer packages, and Composer will not install the ones the panel already provides.
Harder:
- Composer will be a runtime library of the panel, so its vulnerabilities will be the panel's to patch.
- Composer's own extension requirements will become requirements of the binary.
- The modules project's
provideblock will need generating from the panel's own lock file, and keeping in sync whenever modules are added, removed or updated.
Constrained:
- Module metadata that Composer's schema does not carry will live under
extra.tgpin each module'scomposer.json.
Sources
- Issue #35, Engine - Modules, original text of in its edit history: the decision, which is both
createdanddecided, the reason for using Composer as a library, the separate Composer project, the modules autoloader and theprovideblock. - Issue #36, Engine - Modules - Discovery and Manifest, : packages of type
tgp-module, and metadata underextra.tgp. composer.jsonat 7fad8cd, the initial commit:composer/composer, added for installing modules before the design was written.- PR #75, chore: Rename package, add licence and patch Composer CVE, merged and squashed as 3372f20:
Composer's vulnerabilities and extension requirements becoming the panel's, taken from what followed rather than
anticipated.
composer/composerwas updated to 2.10.3 because 2.10.2 is affected by CVE-2026-84361, and 2.10.3 declaresext-filterandext-hash, which the single-binary build will need to compile in.
Source adr/0012-modules-are-installed-with-composer-used-as-a-library.md · commit 072385a · exported