Event
Immutable fact appended to an {@see EventStoreInterface}'s log. A stream's state is never stored directly — it is always the fold of its `Event`s, so this VO is the only unit of truth an event store persists. `streamId` groups events into independent, individually replayable streams (a process instance, an aggregate, an entity id — any identifier the consumer chooses to partition its log by). `type` is a free-form name the consumer defines and interprets; the store itself never inspects it.
Event::__construct()
public function __construct(string $streamId, string $type, array $payload, int $seq):Parameters
| Name | Type | Description |
|---|---|---|
| $streamId | string | the stream this event belongs to |
| $type | string | the event's name, defined and interpreted by the consumer |
| $payload | array<string, mixed> | data carried by this event |
| $seq | int | monotonic position of this event within its event store |
Event::toArray()
public function toArray(): arrayProjects this event into a plain array suitable for JSON encoding (JSONL round-trip).
Event::fromArray()
public static function fromArray(array $row): selfReconstructs an event from the array shape produced by {@see self::toArray()}.
Parameters
| Name | Type | Description |
|---|---|---|
| $row | array{stream_id: string, type: string, payload: array<string, mixed>, seq: int} |