webkernel/lifecycle

Architecture

On this page

Lifecycle connects package declarations to Composer events. The package that owns a task declares it, Composer supplies the event, and Lifecycle validates and invokes the task.

The execution path

StepComponentResponsibility
1LCPluginActivates the plugin and subscribes to supported script and package events.
2LCDeclarationReaderCollects root and installed package metadata.
3LCDeclarationValidatorValidates extra.webkernel before dispatch.
4LCEventDispatcherResolves and validates the callbacks for the current event, then invokes them.
5Built-in workersRefresh paths, run checks and run actions at their declared phases.
6StandardComposerIOGroups output, statuses and timings through Composer IO.

LCBaseInstaller participates separately in Composer's installation manager. It resolves paths for supported Webkernel package types; it is not an event listener declared in extra.webkernel.lifecycle.events.

One package, focused responsibilities

DirectoryPurpose
src/Plugin/Composer activation and event adapters.
src/Declaration/Reading, validation and class-reference resolution.
src/Event/Supported script events and callback dispatch.
src/Check/, src/Action/Check evaluation and action execution.
src/Workers/Built-in callbacks and the optional example action.
src/Install/Supported package types and destination resolution.
src/Path/Composer root path injection.

The extension APIs live at the namespace root: StandardLCEvent, StandardLCAction and StandardComposerIO. Contracts/LifecycleActionContract defines the action boundary. You normally extend these APIs rather than instantiate the engine classes yourself.

How to think about a task

  • It belongs to a particular Composer phase: declare an event listener.
  • It generates one artifact after autoload generation: declare an action.
  • It expresses a supported PHP-version failure condition: declare a check.
  • It only needs a project or dependency path: call a path helper after Composer autoload.

Keep behavior with the package that owns it. The application declares application work; a library or module declares its own work. Built-in workers already run the shared checks and actions, so a package only needs to add its declarations.

Next step

Read Composer and Lifecycle to understand who owns each part of the workflow.