Skip to content

Bootstrap — Built-in Features & Adapter Contracts

Reference for what middag-io/framework's kernel already wires at boot, and the bridge contracts a host adapter (Moodle, WordPress) must implement to plug a host in. See Bootstrap Lifecycle & Tier Responsibilities for how these pieces fit together during ContainerFactory::build(), and FW-012 for the underlying decision.

Built-in boot-time features

FeatureSymbolOSS default
Phased, compiled DI container (PSR-11)ContainerFactorySymfony ContainerBuilder
Service auto-discovery by class-name suffixServiceProvider (*Service, *Repository, *Controller, …)Scans {projectRoot}/src
Single-interface auto-alias to implementationServiceProvider::registerInterfaceAliases()On
Synthetics (host globals injected post-compile)addSynthetic() / setSynthetic()ContainerInterface
Lazy services (ghost proxy, built on first use)#[Lazy] + LazyServiceInstantiatorOn (no-op unless #[Lazy] is used)
Fatal boot isolationBootFailurePolicyInterfaceBootRethrowFailurePolicy (dev) / BootIsolateFailurePolicy (prod)
Real fatal-error guard (shutdown)Http/FatalErrorHandlerOpt-in via register()
Resource cleanup on shutdownKernel/ShutdownCleanupOpt-in via register()
Host maintenance gateMaintenanceGateInterfaceNullMaintenanceGate (never under maintenance)
Facades (testable static proxy)AbstractFacade (swap() / reset())On
12-factor configConfigResolverInterfaceEnvConfigResolver
Form pipeline (validation + Inertia)ServiceProvider::registerFormDefaults()Bound, overridable

Adapter bridge contracts

An adapter is what plugs a specific host into the kernel. It implements:

ContractResponsibilityMoodle (ref.)WordPress (ref.)
BootstrapInterfaceRegister host services; define platform() / getProjectRoot()MoodleBootstrapWordPressBootstrap
ConnectionAdapterInterfaceExpose $DB / $wpdb as a connectionMoodleConnectionAdapterWpdbConnectionAdapter
MaintenanceGateInterfaceReport the host as under upgrade/maintenance$CFG->upgraderunning || during_initial_install()wp_is_maintenance_mode()
ConfigResolverInterfaceResolve host configurationMoodleConfigResolverWpConfigResolver
UserContextResolverInterfaceResolve host user identityMoodleUserContextWpUserContext
TranslatorInterfaceHost i18nget_string() wrapper__() wrapper
HostEventBridgeInterface (experimental)Translate an event to/from a native hook — in practice, the core signal layer is what gets used
HostComponentContextInterfaceNeutral host-component identity (componentName(), assetVersion(), basePath()), registered once by the composition root via HostContext::set()MoodleHostContextWpComponentContext

The concrete classes named above (MoodleBootstrap / WordPressBootstrap, MoodleHostContext / WpComponentContext, and the rest of the "ref." columns) live in the adapter repos — middag-php-moodle and middag-php-wordpress — not in this framework repo. As of this writing those adapters have not been built yet; this table documents the contract surface they are expected to implement.

MIDDAG © 2015-2026