AXIAM PHP SDK

OnReactorEvent
in package

FinalYes

Declares that a method handles one reactor hook event (CONTRACT.md §22.14, canonical `reactor_handlers`).

Placing this attribute on a method does not itself dispatch anything — it is metadata read by ReactorHandlers::of(), which builds the single callable(ReactorEvent): ReactorAnswer that ReactorServer already takes. This mirrors how RequireAccess carries §11 metadata for a framework listener to enforce.

final class ClaimsReactor
{
    #[OnReactorEvent(ReactorEvents::TOKEN_PRE_ISSUE)]
    public function enrich(ReactorEvent $event): ReactorAnswer
    {
        return ReactorAnswer::mutate(['ext.department' => 'engineering']);
    }
}

$handler = ReactorHandlers::of(new ClaimsReactor());

The event name is validated in the constructor, when the attribute is instantiated by ReactorHandlers::of(), so a typo fails at wiring time rather than becoming an event that silently never fires (§22.14 rule 2). A name outside the §22.5 registry is refused — which is also how §22.7's hot-path operations are refused, since they are in no registry row.

Attributes
#[Attribute]
\Attribute::TARGET_METHOD

Table of Contents

Properties

$event  : string

Methods

__construct()  : mixed

Properties

Methods

__construct()

public __construct(string $event) : mixed
Parameters
$event : string

A §22.5 registry event name, e.g. ReactorEvents::TOKEN_PRE_ISSUE.

Tags
throws
InvalidArgumentException

when $event is outside the registry.

On this page

Search results