battleyephp / guid
PHP BattlEye GUID
v2.0.0
2026-03-20 01:58 UTC
Requires
- php: ^8.3
Requires (Dev)
- laravel/pint: ^1.29
- pestphp/pest: ^4.4
- phpstan/phpstan: ^2.1.42
- rector/rector: ^2.3.9
README
It provides BattlEye GUID value object.
It also can be converted from SteamID64.
Installation
Requires PHP 8.3+
You can install the package via composer:
composer require battleyephp/guid
Usage
To 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\Exceptions\InvalidGuidException; use BattlEye\Guid\Guid; try { Guid::fromString('invalid'); } catch (InvalidGuidException) { // ... }
Shortcut method to check if GUIDs are the same:
use BattlEye\Guid\Guid; $one = Guid::fromString('a0d1158281d8639495a1908b5a802470'); $two = Guid::fromSteamId64(76561198066209976); if ($one->equals($two)) { // they are the same... }
Testing
composer test