Nexus API Reference

ValinorJsonSerializer
in package
implements MessageSerializer

Read onlyYes
FinalYes
Tags
psalm-api

Direct-class JSON serializer using Valinor. Unlike ValinorMessageSerializer, this one takes the target class FQCN directly — no TypeRegistry lookup — so it's the right fit for HTTP body decoding via #[FromBody], where the param's class type IS the target.

Encode uses json_encode on public readonly properties. Decode uses Valinor's mapper for strict type reconstruction (constructor promotion, variant unions, enum coercion, etc).

Table of Contents

Interfaces

MessageSerializer

Methods

__construct()  : mixed
deserialize()  : object
Deserializes a string representation back into a message object.
serialize()  : string
Serializes a message object to a string representation.

Methods

__construct()

public __construct([MapperBuilder|null $mapperBuilder = null ]) : mixed
Parameters
$mapperBuilder : MapperBuilder|null = null

deserialize()

Deserializes a string representation back into a message object.

public deserialize(string $data, string $type) : object
Parameters
$data : string
$type : string
Tags
throws
MessageDeserializationException
Attributes
#[NoDiscard]
#[Override]
Return values
object

serialize()

Serializes a message object to a string representation.

public serialize(object $message) : string
Parameters
$message : object
Tags
throws
MessageSerializationException
Attributes
#[NoDiscard]
#[Override]
Return values
string
On this page

Search results