APPNETOS is under active development This website and its documentation are being prepared for public launch. Content and features may change.
Select Theme
Loading

Shared

Registry-managed shared class instances.

Purpose & processing

Marks a class as shared in the APPNETOS Registry. The same instance is returned by Registry::get() and Registry::getNew() during the runtime lifecycle.

Parameters

This attribute has no constructor parameters.

Example

#[Shared]
class ApplicationService extends \Core\Base {}

Behavior and considerations

  • The concrete class and its parent hierarchy are considered when resolving shared metadata.
  • This is a Registry-managed singleton, not a private-constructor PHP singleton.
  • Direct construction with new is not equivalent to Registry-managed resolution.

Source

shared/src/Core/Annotation/Shared.php

Next Steps

Previous

Lifecycle & Object Management

Explore Lifecycle & Object Management

Next

Shutdown

Explore Shutdown