Serializer
class Serializer (View source)
Collection of methods to help with serialization of protobuf objects
Constants
MAP_KEY_FIELD_NAME |
|
MAP_VALUE_FIELD_NAME |
|
Methods
Serializer constructor.
Encode protobuf message as a PHP array
Decode PHP array into the specified protobuf message
No description
No description
Decode metadata received from gRPC status object
Decode an array of Any messages into a printable PHP array.
No description
No description
Convert string from camelCase to snake_case
Convert string from snake_case to camelCase
No description
Details
__construct(array $fieldTransformers = [], array $messageTypeTransformers = [], array $decodeFieldTransformers = [], array $decodeMessageTypeTransformers = [])
Serializer constructor.
array
encodeMessage(mixed $message)
Encode protobuf message as a PHP array
mixed
decodeMessage(mixed $message, array $data)
Decode PHP array into the specified protobuf message
static string
serializeToJson(Message $message)
No description
static array
serializeToPhpArray(Message $message)
No description
static array
decodeMetadata(array $metadata)
Decode metadata received from gRPC status object
static array
decodeAnyMessages(iterable $anyArray)
Decode an array of Any messages into a printable PHP array.
static string
getGetter(string $name)
No description
static string
getSetter(string $name)
No description
static string
toSnakeCase(string $key)
Convert string from camelCase to snake_case
static string
toCamelCase(string $key)
Convert string from snake_case to camelCase
static
loadKnownMetadataTypes()
No description