A library for parsing Steam IDs
- php-7.4
- ext-ctype
composer require signpostmarv/steam-id
Psalm saves on implementing runtime checks that can be detected with static analysis.
For example, at the time of writing an ID's Universe component does not go higher than 5 but uses an 8-bit field, but the following code will fail to pass a check on psalm:
new \SignpostMarv\SteamId\SteamId(0, 0, 0, 0, 6);
ERROR: InvalidArgument - Argument 5 of SignpostMarv\SteamId\SteamId::__construct expects int(0)|int(1)|int(2)|int(3)|int(4)|int(5), int(6) provided
Use either the BCMath or GMP calculators if the relevant php extension is available.
use SignpostMarv\SteamId\Parser;
$parser = new Parser();
$id = $parser->FromString('76561197960287930');
$url = $parser->ToSteamCommunityUrl($id);
Apache-2.0