vikas5914 / steam-auth
A simple PHP Steam login and User Detail package
Installs: 1 967
Dependents: 0
Suggesters: 0
Security: 0
Stars: 17
Watchers: 4
Forks: 10
Open Issues: 2
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2024-10-25 05:13:35 UTC
README
This package enables you to easily log users in via Steam and get user details , using their OpenID service. However, this package does not require that you have the OpenID PHP module installed!
Installation Via Composer
Add this to your composer.json
file, in the require object:
"vikas5914/steam-auth": "1.*"
After that, run composer install
to install the package.
OR
composer require vikas5914/steam-auth:1.*
Usage example
require __DIR__ . '/vendor/autoload.php'; $config = array( 'apikey' => 'xxxxxxxxxxxxxxxxx', // Steam API KEY 'domainname' => 'http://localhost:3000', // Displayed domain in the login-screen 'loginpage' => 'http://localhost:3000/index.php', // Returns to last page if not set "logoutpage" => "", "skipAPI" => false, // true = dont get the data from steam, just return the steamid64 ); $steam = new Vikas5914\SteamAuth($config); if ($steam->loggedIn()) { echo "Hello " . $steam->personaname . "!"; echo "<a href='" . $steam->logout() . "'>Logout</a>"; } else { echo "<a href='" . $steam->loginUrl() . "'>Login</a>"; }
User-Data is accessible through $steam->varName;
You can find a basic list of variables in the demo file or a more advanced one in the code.
Check if the user is logged in with $steam->loggedIn();
(Will return true or false)
Planned
- Test Case
- Better ReadMe
Legal stuff
If you choose to use the steam web-api you need to follow the Steam Web API Terms of Use found at http://steamcommunity.com/dev/apiterms
The marked code is taken from Syntax_Error's "Ultra Simple Steam-Login" Class found at http://forums.steampowered.com/forums/showthread.php?t=1430511