English | 中文文档
super-kernel/contract holds the interfaces shared by otherwise independent SuperKernel components. It contains interfaces only: depending on it lets a package type against a shared boundary without selecting an implementation. Install the component that implements a contract to obtain it from the container.
- Application:
ApplicationInterfaceexposes the selected application'srun(): intboundary without selecting its concrete host or runtime. Implemented bysuper-kernel/framework. - Project paths:
BasePathInterfaceextendsStringableand returns the canonical project directory or the running application'sphar://root.VendorDirInterfaceis a separateStringablevalue for the Composer dependency directory, which need not exist. Implemented bysuper-kernel/composer. - Container:
ContainerInterfaceis the shared-service boundary used by framework components while retaining PSR-11 interoperability. Class and interface identifiers resolve to compatible instances; other PSR-11 identifiers may return any value. Implemented bysuper-kernel/di. - Configuration:
ConfigInterface::has(string $interface, ?string $name = null)andget(string $interface, ?string $name = null): ?objectprovide typed configuration.SingleConfigInterfacemarks one configuration object;MultipleConfigInterfacemarks a source of attributed item methods. A sole item is automatically the default. With several items, unnamed lookup requires an explicit default; named lookups remain available without one. Implemented bysuper-kernel/config. - Packages:
PackageManagerInterfaceprovides deterministic root and locked package enumeration, case-insensitive name lookup, exact declared-type filtering, environment requirements, per-package and aggregate class maps, and exact class ownership. Package results usePackageMetadataInterface; environment requirements useEnvironmentRequirementInterfacefor the platform name, constraint, declaring package, and root development flag.version(): ?stringreturns the exact declared string, or null when the root manifest omits it, without inference, normalization, comparison, or format validation. InjectVendorDirInterfacefor the dependency directory. Implemented bysuper-kernel/composer. - Autoloading:
AutoLoaderInterfacecovers SPL invocation, pending mappings, preload interceptors, and registration and removal status. Removal failures areRuntimeException. Implemented bysuper-kernel/autoloader. - Attribute collection:
AnnotationCollectorInterfaceprovides package-aware exact and assignable lookup of class, method, and property Attributes. Lookups return trusted Attribute instances throughAttributeMetadataInterface<T>(name(),attribute(), andtypes()), and method results keep their declaring classes, exact method names, first-package ownership, and ordered matching metadata.PackageAnnotationsInterfaceexposes one package's name, reference, and declared class, method, and property maps. Implemented bysuper-kernel/annotator. - Property injection:
PropertyAttributeHandlerInterfaceandPropertyContextInterfacebind native property Attributes to container-bound handlers through an assignment context. Consumed bysuper-kernel/di. - Events:
EventInterfacemarks framework and component events without prescribing payload shape, listener behavior, or a dispatcher implementation. Framework events are declared bysuper-kernel/event. - Listeners:
ListenerInterfaceexposes the indexed list of event class names a listener handles and the object-typedprocess()entry point for matching events. Implementations that declare multiple events distinguish the concrete event insideprocess(). Dispatched bysuper-kernel/event-dispatcher. - Exception dispatch:
ExceptionDispatcherInterfaceaccepts oneThrowableand returnsvoid. Implemented bysuper-kernel/exception-dispatcher. - Reflection:
ReflectorInterfacereturns reusable nativeReflection*objects without translating PHP's native inspection API and failures. Implemented bysuper-kernel/reflector. - Named logging:
StdoutLoggerInterfaceidentifies SuperKernel's PSR-3 stdout service for framework and exception records without selecting a handler, formatter, channel, or minimum level. Applications may replace its transport, threshold, and formatter. Implemented bysuper-kernel/logger.
AnnotationCollectorInterface::getPackage() returns ?PackageAnnotationsInterface, and array results expose the shared metadata interfaces, so consumers can provide independent metadata implementations without a concrete Annotator model. These interfaces do not promise serialization support for arbitrary implementations: Annotator's cache admits only its own models.
ScanDiagnosticsInterface is an independent read capability with only getDiagnostics(): array. It is not an additional collector binding. Annotator packages and collections implement it; other AnnotationCollectorInterface and PackageAnnotationsInterface implementations need not add methods.
Rows contain exactly sequence (positive scan-wide integer), package (normalized non-empty owner name), class, exception_type (non-empty captured strings), and message (original string bytes). A package exposes its subset, while a complete collection combines subsets in scan order. Captured names need not exist in the runtime and must not be autoloaded just to read diagnostics. No Throwable is part of the contract.
use SuperKernel\Contract\AnnotationCollectorInterface;
use SuperKernel\Contract\ScanDiagnosticsInterface;
/** @var AnnotationCollectorInterface $collector */
if ($collector instanceof ScanDiagnosticsInterface) {
$diagnostics = $collector->getDiagnostics();
}