All Projects → xPaw → Steamid.php

xPaw / Steamid.php

Licence: mit
🆔 PHP library to work with SteamIDs

Projects that are alternatives of or similar to Steamid.php

Steamworks
Exposing SteamWorks functions to SourcePawn.
Stars: ✭ 70 (-15.66%)
Mutual labels:  valve, steam
HammerPatch
Modification of Source Valve Hammer Editor to fix some issues. Fixes brush vertex precision loss.
Stars: ✭ 49 (-40.96%)
Mutual labels:  steam, valve
SteamHelper-rs
Interact with Valve's Steam network with this collection of crates.
Stars: ✭ 24 (-71.08%)
Mutual labels:  steam, valve
Steamcmd Autoupdate Any Gameserver
Windows SteamCMD to autoupdate and install any game server steam cmd settings configurable lots of useful features. This batch script will keep your game servers automaticly updated updating intervals announce the server is shutting down for updates etc all configurable.
Stars: ✭ 77 (-7.23%)
Mutual labels:  valve, steam
Valveresourceformat
🔬 Valve's Source 2 resource file format parser and decompiler
Stars: ✭ 638 (+668.67%)
Mutual labels:  valve, steam
halflife-op4-updated
Half-Life: Opposing Force SDK based on Half-Life Updated, with bug fixes. Check README.md for more information.
Stars: ✭ 57 (-31.33%)
Mutual labels:  steam, valve
steam.py
An async python wrapper to interact with the Steam API and its CMs
Stars: ✭ 74 (-10.84%)
Mutual labels:  steam, valve
AreWeAntiCheatYet
A comprehensive and crowd-sourced list of games using anti-cheats and their compatibility with GNU/Linux or Wine.
Stars: ✭ 289 (+248.19%)
Mutual labels:  steam, valve
Uwphook
🔗 Add your Windows Store or UWP games to Steam
Stars: ✭ 566 (+581.93%)
Mutual labels:  valve, steam
Steamtracking
🕵 Tracking things, so you don't have to
Stars: ✭ 542 (+553.01%)
Mutual labels:  valve, steam
valve-matchmaking-ip-ranges
Lists of locations & IP addresses of Valve servers
Stars: ✭ 69 (-16.87%)
Mutual labels:  steam, valve
Depressurizer
A Steam library categorizing tool.
Stars: ✭ 1,008 (+1114.46%)
Mutual labels:  valve, steam
newsteamchat
Metro skin for Steam chat and friends UI.
Stars: ✭ 79 (-4.82%)
Mutual labels:  steam, valve
ChatLogger
ChatLogger is a Steam Tool based on the SteamKit2 library, designed to save your and friends messages! [Metro Theme]
Stars: ✭ 39 (-53.01%)
Mutual labels:  steam, valve
FLOSS-Games-on-Steam
A list of FLOSS games available on Steam
Stars: ✭ 90 (+8.43%)
Mutual labels:  steam, valve
VTFLib
VTFLib is a LGPL open source programming library that provides a C and C++ API for reading and writing Valve VTF and VMT format image files.
Stars: ✭ 68 (-18.07%)
Mutual labels:  steam, valve
JavaSteam
Java library that provides an interface to directly interact with Valve's Steam servers.
Stars: ✭ 70 (-15.66%)
Mutual labels:  steam, valve
php-steam-web-api-client
Automatically generated api client for the Steam Web API.
Stars: ✭ 79 (-4.82%)
Mutual labels:  steam, valve
Steam
☁️ Python package for interacting with Steam
Stars: ✭ 489 (+489.16%)
Mutual labels:  valve, steam
Archisteamfarm
C# application with primary purpose of idling Steam cards from multiple accounts simultaneously.
Stars: ✭ 7,219 (+8597.59%)
Mutual labels:  valve, steam

SteamID.php Packagist

This 64bit structure is used for identifying various objects on the Steam network. This library provides an easy way to work with SteamIDs and makes conversions easy.

This library does not use subtraction hacks like described on Valve Developer Wiki, or used in many other functions.

SteamID.php requires PHP version to be 5.4 or higher, and GMP module to be installed to perform operations on unsigned 64-bit integers.

Brief overview

A SteamID is made up of four parts: its universe, its type, its instance, and its account ID.

  • Universe: Currently there are 5 universes. A universe is a unique instance of Steam. You'll probably only be interacting with the public universe, which is the regular Steam. Only Valve employees can access non-public universes.
  • Type: A SteamID's type determines what it identifies. The most common type is individual, for user accounts. There are also other types such as clans (Steam groups), gameservers, and more.
  • Instance: Steam allows three simultaneous user account instances right now (1 = desktop, 2 = console, 4 = web, 0 = all)
  • Account ID: This represents a unique account of a type.

Using this library

It's really easy to use it, as constructor automatically figures out given input and works its magic from there. If provided SteamID is not in a valid format, an InvalidArgumentException is thrown. You can call IsValid on given SteamID instance to perform various checks which make sure that given account type / universe / instance are correct. You can view test file for multiple examples on how to manipulate SteamIDs.

Example

try
{
	// Constructor also accepts Steam3 and Steam2 representations
	$s = new SteamID( '76561197984981409' );
}
catch( InvalidArgumentException $e )
{
	echo 'Given SteamID could not be parsed.';
}

// 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;

SteamID normalization

If you run some website where users can enter their own SteamIDs, sometimes you might encounter SteamIDs which have wrong universe or instanceid set, which will result in a completely different, yet valid, SteamID. To avoid this, you can manipulate given SteamID and set universe to public and instance to desktop.

try
{
	$s = new SteamID( $ID );
	
	if( $s->GetAccountType() !== SteamID :: TypeIndividual )
	{
		throw new InvalidArgumentException( 'We only support individual SteamIDs.' );
	}
	else if( !$s->IsValid() )
	{
		throw new InvalidArgumentException( 'Invalid SteamID.' );
	}
	
	$s->SetAccountInstance( SteamID :: DesktopInstance );
	$s->SetAccountUniverse( SteamID :: UniversePublic );
}
catch( InvalidArgumentException $e )
{
	echo $e->getMessage();
}

After doing these steps, you can call RenderSteam3, RenderSteam2 or ConvertToUInt64 to get normalized SteamID.

Functions

Name Parameters Description
IsValid - Gets a value indicating whether this instance is valid.
RenderSteam2 - Renders this instance into it's Steam2 "STEAM_" representation.
RenderSteam3 - Renders this instance into it's Steam3 representation.
RenderSteamInvite - Encodes accountid as HEX which can be used in `http://s.team/p/` URL.
ConvertToUInt64 - Converts this SteamID into it's 64bit integer form.
SetFromUInt64 string or int (e.g 765...) Sets the various components of this SteamID from a 64bit integer form.
GetAccountID - Gets the account id.
GetAccountInstance - Gets the account instance.
GetAccountType - Gets the account type.
GetAccountUniverse - Gets the account universe.
SetAccountID New account id Sets the account id.
SetAccountInstance New account instance Sets the account instance. (e.g. SteamID::DesktopInstance)
SetAccountType New account type Sets the account type. (e.g. SteamID::TypeAnonGameServer)
SetAccountUniverse New account universe Sets the account universe. (e.g. SteamID::UniversePublic)

New Steam invite URLs

Valve introduce a new way of sharing profile URLs (https://s.team/p/hjqp or https://steamcommunity.com/user/hjqp). The encoding is simply hex encoded account id and each letter being replaced with a custom alphabet. While HEX originally is 0-9a-f, in the converted version numbers and letters a or e are not included, but they still work in the URL because Valve does a single pass replacement.

This library natively supports parsing s.team/p/ or steamcommunity.com/user/ URLs in SetFromURL function.

Here's the mapping of replacements:

Hex Letter
0 b
1 c
2 d
3 f
4 g
5 h
6 j
7 k
8 m
9 n
a p
b q
c r
d t
e v
f w

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].