Documentation

NilUlid extends Ulid
in package

A ULID is lexicographically sortable and contains a 48-bit timestamp and 80-bit of crypto-random entropy.

Table of Contents

Constants

NIL  = '00000000000000000000000000'

Properties

$uid  : mixed
The identifier in its canonic representation.
$rand  : array<string|int, mixed>
$time  : string

Methods

__construct()  : mixed
__toString()  : string
compare()  : int
equals()  : bool
Returns whether the argument is an AbstractUid and contains the same value as the current instance.
fromBase32()  : static
fromBase58()  : static
fromBinary()  : static
fromRfc4122()  : static
fromString()  : static
Creates an AbstractUid from an identifier represented in any of the supported formats.
generate()  : string
getDateTime()  : DateTimeImmutable
isValid()  : bool
Whether the passed value is valid for the constructor of the current class.
jsonSerialize()  : string
toBase32()  : string
Returns the identifier as a base32 case insensitive string.
toBase58()  : string
Returns the identifier as a base58 case sensitive string.
toBinary()  : string
Returns the identifier as a raw binary string.
toRfc4122()  : string
Returns the identifier as a RFC4122 case insensitive string.

Constants

NIL

protected mixed NIL = '00000000000000000000000000'

Properties

$uid

The identifier in its canonic representation.

protected mixed $uid

$rand

private static array<string|int, mixed> $rand = []

$time

private static string $time = ''

Methods

__construct()

public __construct() : mixed

__toString()

public __toString() : string
Return values
string

compare()

public compare(self $other) : int
Parameters
$other : self
Return values
int

equals()

Returns whether the argument is an AbstractUid and contains the same value as the current instance.

public equals(mixed $other) : bool
Parameters
$other : mixed
Return values
bool

fromBase32()

public static fromBase32(string $uid) : static
Parameters
$uid : string
Tags
throws
InvalidArgumentException

When the passed value is not valid

Return values
static

fromBase58()

public static fromBase58(string $uid) : static
Parameters
$uid : string
Tags
throws
InvalidArgumentException

When the passed value is not valid

Return values
static

fromBinary()

public static fromBinary(string $uid) : static
Parameters
$uid : string
Tags
throws
InvalidArgumentException

When the passed value is not valid

Return values
static

fromRfc4122()

public static fromRfc4122(string $uid) : static
Parameters
$uid : string
Tags
throws
InvalidArgumentException

When the passed value is not valid

Return values
static

fromString()

Creates an AbstractUid from an identifier represented in any of the supported formats.

public abstract static fromString(string $uid) : static
Parameters
$uid : string
Tags
throws
InvalidArgumentException

When the passed value is not valid

Return values
static

generate()

public static generate([DateTimeInterface $time = null ]) : string
Parameters
$time : DateTimeInterface = null
Return values
string

getDateTime()

public getDateTime() : DateTimeImmutable
Return values
DateTimeImmutable

isValid()

Whether the passed value is valid for the constructor of the current class.

public abstract static isValid(string $uid) : bool
Parameters
$uid : string
Return values
bool

jsonSerialize()

public jsonSerialize() : string
Return values
string

toBase32()

Returns the identifier as a base32 case insensitive string.

public toBase32() : string
Return values
string

toBase58()

Returns the identifier as a base58 case sensitive string.

public toBase58() : string
Return values
string

toBinary()

Returns the identifier as a raw binary string.

public abstract toBinary() : string
Return values
string

toRfc4122()

Returns the identifier as a RFC4122 case insensitive string.

public toRfc4122() : string
Return values
string

        
On this page

Search results