Installation
- Edit your
composer.json to require "sgtaziz/steamauth": "~1.2".
- Run
composer update to download and install the package.
- Copy
vendor/sgtaziz/steamauth/src/config/steamauth.php to config/steamauth.php.
- Edit
steamauth.php to include your Steam API key.
- Open up
config/app.php and add 'sgtaziz\SteamAuth\SteamAuthServiceProvider' as a service provider. You must also add 'SteamAuth' => 'sgtaziz\SteamAuth\Facades\SteamAuth' to aliases.
Documentation
Currently, the only real usable function is SteamAuth::Auth(). Example:, (*1)
<?php
$user = SteamAuth::Auth();
if ($user)
{
$name = $user['personaname'];
$steamid64 = $user['steamid'];
echo $name . ' has the steamid ' . $steamid64;
}
SteamAuth::Auth() will automatically redirect the user to Steam's website to login. Once authenticated, it will return to the previous page and $user will be a valid variable if Steam was used successfully to authenticate the user.
SteamAuth::Auth() will also return an associative array with these values:, (*2)
Variables of $user
Public Variables
-
steamid - 64bit SteamID of the user
-
communityvisibilitystate - 1 = Private | 2 = Friends Only | 3 = Public
-
profilestate - When set to one, means that the user has setup their Steam Community profile
-
personaname - The user's Steam alias
-
lastlogoff - Unix timestamp of when the user was last online
-
commentpermission - When available, it means that anyone can comment on the profile
-
profileurl - The URL of the user's profile
-
avatar - A small version of the user's avatar
-
avatarmedium - A medium version of the user's avatar
-
avatarfull - The highest quality version of the user's avatar
-
personastate - 0 = Offline | 1 = Online | 2 = Busy | 3 = Away | 4 = Snooze | 5 = Looking to Trade | 6 = Looking to Play
Private Variables
-
realname - The user's "real name" set on their profile
-
primaryclanid - The user's primary group
-
timecreated - Unix timestamp of the account's creation date
-
gameid - If the user is in a game, the game ID of the game he is currently in
-
gameserverip - When possible, the IP of the server the user is currently in
-
gameextrainfo - The name of the game the user is currently playing
See this for more info., (*3)
Note
This is not meant to be used as a way to authenticate users on your website, but simply a way to get their steam information. Once you do that, you may store it in your own database and use that plus SteamAuth to authenticate users., (*4)