1. Go to this page and download the library: Download xpaw/steamid library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xpaw / steamid example snippets
use xPaw\Steam\SteamID;
try
{
// Constructor also accepts Steam3 and Steam2 representations
$s = new SteamID( '76561197984981409' );
// Renders SteamID in it's Steam3 representation (e.g. [U:1:24715681])
echo $s->RenderSteam3() . PHP_EOL;
// Renders SteamID in it's Steam2 representation (e.g. STEAM_0:1:12357840)
echo $s->RenderSteam2() . PHP_EOL;
// Converts this SteamID into it's 64bit integer form (e.g. 76561197984981409)
echo $s->ConvertToUInt64() . PHP_EOL;
}
catch( InvalidArgumentException $e )
{
echo 'Given SteamID could not be parsed: ' . $e->getMessage();
}
use xPaw\Steam\SteamID;
$accountId = 24715681;
// Create a standard individual SteamID from account ID
$steamId = SteamID::FromAccountID( $accountId );
echo $steamId->RenderSteam3(); // [U:1:24715681]
// Quick conversion to 64-bit format
echo SteamID::AccountIDToUInt64( $accountId ); // 76561197984981409
// Quick conversion to Steam3 format
echo SteamID::RenderAccountID( $accountId ); // [U:1:24715681]
use xPaw\Steam\SteamID;
// Supports various URL formats and direct SteamIDs
$inputs = [
'https://steamcommunity.com/id/username/',
'https://steamcommunity.com/profiles/76561197984981409',
'https://s.team/p/abc-def',
'76561197984981409',
'[U:1:24715681]'
];
foreach( $inputs as $input )
{
try
{
$steamId = SteamID::SetFromURL( $input, 'yourVanityResolverCallback' );
echo $steamId->ConvertToUInt64() . PHP_EOL;
}
catch( InvalidArgumentException $e )
{
echo "Could not parse: $input" . PHP_EOL;
}
}