- 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
toconfig/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.
Currently, the only real usable function is SteamAuth::Auth(). Example:
<?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:
steamid
- 64bit SteamID of the usercommunityvisibilitystate
- 1 = Private | 2 = Friends Only | 3 = Publicprofilestate
- When set to one, means that the user has setup their Steam Community profilepersonaname
- The user's Steam aliaslastlogoff
- Unix timestamp of when the user was last onlinecommentpermission
- When available, it means that anyone can comment on the profileprofileurl
- The URL of the user's profileavatar
- A small version of the user's avataravatarmedium
- A medium version of the user's avataravatarfull
- The highest quality version of the user's avatarpersonastate
- 0 = Offline | 1 = Online | 2 = Busy | 3 = Away | 4 = Snooze | 5 = Looking to Trade | 6 = Looking to Play
realname
- The user's "real name" set on their profileprimaryclanid
- The user's primary grouptimecreated
- Unix timestamp of the account's creation dategameid
- If the user is in a game, the game ID of the game he is currently ingameserverip
- When possible, the IP of the server the user is currently ingameextrainfo
- The name of the game the user is currently playing
See this for more info.
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.