parse

Learn how to parse a UUID from a string.

This method parses a UUID from its canonical string form, normalizing it to lowercase.

Signature

This method has the following signature:

public static function parse(string $value): self

This method returns a new instance built from the given value. It throws an InvalidArgumentException when the value is not a valid UUID.

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\Uuid;
$uuid = Uuid::parse('f47ac10b-58cc-4372-a567-0e02b2c3d479');

Parameters

The following list describes the supported parameters:

value
string

The canonical string form of the UUID to parse.