It provides BattlEye GUID value object.
It also can be converted from SteamID64.
Requires PHP 8.2+
You can install the package via composer:
composer require battleyephp/guidTo create a GUID from a SteamID64:
use BattlEye\Guid\Guid;
$guid = Guid::fromSteamId64(76561198066209976);
echo $guid->toString(); // 'a0d1158281d8639495a1908b5a802470'
// It is stringable, so you can
// cast it to the string.
echo (string) $guid;You can pass an already calculated GUID string to create an object:
use BattlEye\Guid\Guid;
$guid = Guid::fromString('a0d1158281d8639495a1908b5a802470');
// same as
$guid = new Guid('a0d1158281d8639495a1908b5a802470');Note: It can contain only valid MD5 hash, otherwise it throws an exception.
use BattlEye\Guid\Guid;
use InvalidArgumentException;
try {
Guid::fromString('invalid');
} catch (InvalidArgumentException) {
// Invalid GUID
}composer test