battleyephp / guid
PHP BattlEye GUID
Installs: 92
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:package
Requires
- php: ^8.2
Requires (Dev)
- laravel/pint: ^1.22
- pestphp/pest: ^3.8
- phpstan/phpstan: ^2.1
- rector/rector: ^2.0
README
It provides BattlEye GUID value object.
It also can be converted from SteamID64.
Installation
Requires PHP 8.2+
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\Guid; use InvalidArgumentException; try { Guid::fromString('invalid'); } catch (InvalidArgumentException) { // Invalid GUID }
Testing
composer test