class BinaryCodec (View source)

Properties

static protected UuidInterface|Ulid|string|null): ?string, decode: callable(?string): ?string}> $customCodecs

Methods

static void
register(string $name, callable $encode, callable $decode)

Register a custom codec.

static string|null
encode(UuidInterface|Ulid|string|null $value, string $format)

Encode a value to binary.

static string|null
decode(string|null $value, string $format)

Decode a binary value to string.

static array
formats()

Get all available format names.

static bool
isBinary(mixed $value)

Determine if the given value is binary data.

Details

static void register(string $name, callable $encode, callable $decode)

Register a custom codec.

Parameters

string $name
callable $encode
callable $decode

Return Value

void

static string|null encode(UuidInterface|Ulid|string|null $value, string $format)

Encode a value to binary.

Parameters

UuidInterface|Ulid|string|null $value
string $format

Return Value

string|null

Exceptions

InvalidArgumentException

static string|null decode(string|null $value, string $format)

Decode a binary value to string.

Parameters

string|null $value
string $format

Return Value

string|null

Exceptions

InvalidArgumentException

static array formats()

Get all available format names.

Return Value

array

static bool isBinary(mixed $value)

Determine if the given value is binary data.

Parameters

mixed $value

Return Value

bool

Laravel Cloud is the best place to deploy Laravel, Nuxt, Express, Hono, Node.js, Bun, Go, Flask, Python, and more, with dedicated infrastructure available on AWS through Laravel Private Cloud.