signpostmarv / steam-id
SteamID Parsing
v0.2.0
2022-06-21 23:38 UTC
Requires
- php: ^7.4|^8.1
- ext-ctype: *
- signpostmarv/brick-math-base-convert: ^0.2.0
Requires (Dev)
- infection/infection: ^0.26.12
- maglnet/composer-require-checker: ^3
- php-coveralls/php-coveralls: ^2.5
- phpunit/phpunit: ^9.5
- povils/phpmnd: ^2.5
- psalm/plugin-phpunit: ^0.17.0
- sebastian/phpcpd: ^6.0
- signpostmarv/php-cs-fixer-config: ^0.23.0
- vimeo/psalm: ^4.23
Suggests
- signpostmarv/brick-math-base-convert-bcmath: Handle base-10 & base-2 conversions with ext-bcmath
- signpostmarv/brick-math-base-convert-gmp: Handle base-10 & base-2 conversions with ext-gmp
Conflicts
- vimeo/psalm: <4.23
README
A library for parsing Steam IDs
Requirements
- php-7.4
- ext-ctype
Install
composer require signpostmarv/steam-id
Suggested Steps
Use vimeo/psalm
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
Optional Steps
Use either the BCMath or GMP calculators if the relevant php extension is available.
Examples
Obtain Steam Community URL
use SignpostMarv\SteamId\Parser; $parser = new Parser(); $id = $parser->FromString('76561197960287930'); $url = $parser->ToSteamCommunityUrl($id);
License
Apache-2.0