Skip to content
docsv0.1.0

Kernel

The fresh, bootable Milpa kernel: COMPOSES the published family instead of reimplementing it. `boot()` wires, in order: a DI container ({@see \Milpa\Container\DIContainer}) -> an event dispatcher ({@see \Milpa\Eventing\EventDispatcher}) -> a capability-graph check ({@see CapabilityGraphChecker}, fails BEFORE any plugin boots) -> plugins loaded and booted in `provides`-\>`requires` order (ordering computed by `milpa/plugin`'s {@see ContractResolver}) -> route table assembly over `milpa/http`. Every step emits the same lifecycle events the legacy host kernel's event-driven retrofit introduced (`plugin.booting`/`plugin.booted`, `capability.resolved`, `kernel.booted` — see {@see \Milpa\Runtime\Events}). Zero Doctrine, zero legacy `Milpa\Web`: the active-plugins list is whatever `list<class-string>` the caller passes via `$config['plugins']` — a config array, a file `require`d into that array, or filesystem discovery the caller performs before calling `boot()`. This class never queries a database to decide what to boot; a persistence-backed plugin registry is something a *plugin* can add later, never something the kernel requires.

Kernel::boot()

public static function boot(array $config = []): self

Boots the kernel: builds (or accepts injected) collaborators, resolves the host root, capability-checks and orders the configured plugins, boots each in order while emitting the lifecycle events, and assembles the route table from every booted `RouteProviderInterface` plugin.

Parameters

Parameters of boot()
NameTypeDescription
$configarray{root?: (string | null), plugins?: list<class-string>, config?: array<string, mixed>, container?: DIContainerInterface, dispatcher?: MilpaEventDispatcherInterface, logger?: LoggerInterface, toolRegistry?: (ToolRegistryInterface | null)}Every key is optional: `root` defaults to {@see RootResolver}'s auto-detection, `plugins` defaults to an empty list, `config` is the app-config bag plugins read via `$container->get(Config::class)` (the seam that replaces plugin constructor args and env-var globals), `container`/`dispatcher`/`logger` default to fresh family instances (injecting your own is the seam tests use to observe lifecycle events before `boot()` runs), `toolRegistry` defaults to null — wiring one is the host's opt-in, `milpa/runtime` never constructs one itself.

Throws

AttributeNotFoundException A configured plugin class carries no `#[PluginMetadata]`.

\Milpa\Exceptions\Plugin\PluginDependencyException A plugin `requires` a capability no configured plugin `provides`.

\Milpa\Runtime\Support\RootNotFoundException The host root could not be resolved and none was given explicitly.

Kernel::container()

public function container(): Milpa\Interfaces\Di\DIContainerInterface

The DI container every plugin and controller was resolved through.

Kernel::dispatcher()

public function dispatcher(): Milpa\Interfaces\Event\MilpaEventDispatcherInterface

The event dispatcher every lifecycle event was emitted on.

Kernel::router()

public function router(): Milpa\Runtime\Http\Router

The route table assembled from every booted `RouteProviderInterface` plugin.

Kernel::plugins()

public function plugins(): array

Every configured plugin instance, including any vetoed via a `plugin.booting` listener.

Kernel::bootedPluginNames()

public function bootedPluginNames(): array

Names of the plugins whose `boot()` actually ran, in boot order.

Kernel::root()

public function root(): string

The resolved host application root directory.

Kernel::toolRegistry()

public function toolRegistry(): ?Milpa\Interfaces\Tooling\ToolRegistryInterface

The tool registry wired via `$config['toolRegistry']`, or null if the host opted out.