The Game Panel specification

ADR-0004: The container does not implement PSR-11

Context

PSR-11 defines a common container interface: get() and has(), keyed by a string identifier. Its value is interchangeability. A project can swap one container for another, and a component written against the interface can be reused with any container that implements it.

The panel is a bespoke, purpose-built system distributed as a single binary, not a framework. Nobody swaps its container out, and nothing integrates with the panel at the level of its container.

Decision

The container does not implement PSR-11. Callers describe what they want to resolve or invoke with the container’s own Resolution and Invocation objects, not with a string identifier passed to get(), and no part of the panel depends on the Psr\Container interfaces.

Alternatives

Implementing PSR-11, alongside the container’s own API, which is the option this decision rejects. The interchangeability it provides does not apply to a bespoke system shipped as a single binary. The PSRs are also dated, and implementing one forces a design into its shape, where the container is instead free to be shaped around what the panel needs.

Whether it was weighed at the time, or simply never adopted, is not recorded, and no other alternative appears in the record.

Consequences

Easier:

Harder:

Constrained:

Sources