webkernel/lifecycle

Public API

On this page

The usual extension surface consists of the three standard classes, the action contract, path helpers and declarations. Composer's Event below means Composer\Script\Event; IOInterface means Composer\IO\IOInterface.

StandardLCEvent

Namespace: Webkernel\Lifecycle.

MethodVisibilityPurpose
__invoke(Event $event): voidFinal public.Stores the event and runs the listener.
composerEvent(): EventFinal protected.Returns invocation context; throws before an event is supplied.
run(): voidAbstract protected.Implement the listener's work.

StandardLCAction

Namespace: Webkernel\Lifecycle. Implements Contracts\LifecycleActionContract.

MethodVisibilityPurpose
key(): stringPublic, overridable.Derived kebab-case key.
name(): stringPublic, overridable.Derived display name.
handle(Event $event): voidFinal public.Stores the event and runs the action.
composerEvent(): EventFinal protected.Returns invocation context; throws before an event is supplied.
run(): voidAbstract protected.Implement the action's work.

LifecycleActionContract requires key(), name() and handle(Event $event). Direct implementations provide all three public methods. Keys do not cause deduplication in the current runner.

StandardComposerIO

Namespace: Webkernel\Lifecycle. All methods are static.

MethodPurpose
`write(string\array $messages): void`
`error(string\array $messages): void`
branch(string $message, callable $draw_children, string $color = 'default'): mixedGroups nested tree output and returns the callback result.
line(string $message): voidAdds a tree line.
result(string $status, string $message, ?string $duration = null): voidAdds a styled status line.
blankLine(bool $continue_current_branch = false): voidAdds a blank tree entry.
duration(int $nanoseconds): stringFormats a non-negative duration; negative input throws LogicException.
tree(string $event_name, callable $draw_children, ?callable $completion = null): mixedOwns an output tree; nesting throws LogicException.
bind(IOInterface $io): ?IOInterfaceSets IO and returns the previous binding.
restore(?IOInterface $io): voidRestores a previous binding.

In ordinary listeners/actions, the plugin owns binding and tree lifetime. Use write(), error() and branches inside that scope. Manual integrations must restore a binding in finally. See Composer Output.

Global functions

SignatureScope
base_path(string $path = ''): stringComposer root path.
vendor_path(string $path = ''): stringFirst registered Composer loader's directory, cached on first use.
webkernel_package(string $package, ?string $sub_path = null): stringCanonical installed path for webkernel/<package>, cached per package.

Functions are defined only when their names are available. See the Path Helpers for exact return, error and cache behavior.

Engine and Composer integration

These public entry points support internal orchestration. Extend the standard APIs for ordinary package tasks; direct use requires the appropriate Composer context and bound IO where output is emitted.

ComponentEntry points
Declaration\LCDeclarationReaderread(Composer $composer): array, static forget(Composer $composer): void.
Declaration\LCDeclarationValidatorvalidate(string $package_name, string $package_type, array $webkernel_extra): void.
Declaration\LCClassReferenceResolverresolve(string $reference, array $psr4_prefixes, string $package_name): string.
Event\LCEventDispatcherdispatch(string $event_name, object $event, array $packages, int $started_at): void.
Event\LCEventTargetBacked enum; extraKey(): string.
Check\LCCheckRunnerrun(Event $event): void.
Action\LCActionRunnerrun(Event $event): int, returning failed action count.
Path\LCBasePathInjectorStatic inject(?Composer $composer = null): void.
Install\LCBaseInstallersupports(string $packageType): bool, getInstallPath(PackageInterface $package): string.
Install\LCInstallerLocationstypes(): array, destination(PackageInterface $package): ?string, parentModule(PackageInterface $package): ?array.
Install\LCPackageTypeBacked enum; description(): string, requiresParentModule(): bool.
Plugin\LCPluginComposer plugin lifecycle, getSubscribedEvents(), onScriptEvent(), onPackageEvent().
Plugin activation and event adaptersLCPluginActivator::activate(), LCPluginScriptEventHandler::handle(), LCPackageOperationEventHandler::handle().

Composer supplies its plugin interfaces and event classes while running Composer. These classes are not a substitute for the application's runtime container or HTTP lifecycle.