Git Product home page Git Product logo

steam-widget's Introduction

This project is archived, no longer being maintained and probably full of security holes. I made this when I was younger as a learning experience so.. use at your own risk..

SteamWidget

Using this php class I've made utilizes steams API so you can easly create a table of all your Steam games with logos and how much time you've spent playing of each game you own OR output the stats in the form of a multidimentional array you can output into your own styled page. You can also display a styled output of your current online status with your screen name and if you're playing a game, the name of that game. Each call requires the sID64 of the user to query which is sometimes hard to find so i've also included a small script that will convert a SteamID into the SteamID64 for use with making queries. Still working on making it more friendly for multiple users.

Setup

  1. Go to http://steamcommunity.com/dev/apikey and get an api key if you don't already have one.

  2. Open SteamWidget.class.php to line 6 and replace the pound symbols with your apikey.

     define("APIKEY", "###########################");
    
  3. you can also add a default profile to displace if a SteamID64 errors.

     define("DEFAULTPROF", "76561198016593929");
    
  4. You can added a fallback image for games without a logo, point to the image here.

     define("NOIMAGE", "css/noimage.jpg");
    

How to use

To call username for current online status use these lines
It will echo out current online status (online, offline, away, in-game). If user is in game it will print out the game title as a link to get the game in the store.
$steamwidget = new SteamWidget(); echo $steamwidget->current_steam_status();
To call a prestyled table of a user's owned games
This will query steams API to get a list of all games that a user owns with the game's logo, user's playtime data and even a link to the game in the Steam store.
	$steamwidget = new SteamWidget();
	echo $steamwidget->query_games_styled($usersSteamID64);
To call a for all of a user's owned games to return as a multidimentional array
array outputs: number, name, appid, playtimeAgo, gamelogourl (more to come possibly)
		<?php $steamwidget = new SteamWidget();
		$games = $steamwidget->query_games($sID64ToQuery);
		foreach ($games as $number => $game): ?>
		<tr>
			<td><?php echo $game['number'];?></td>
			<td><img src="<?php echo $game['gamelogourl'];?>" /></td>
			<td><h4><a href="<?php echo 'http://store.steampowered.com/app/' . $game['appid'];?>"><?php echo $game['name'];?></a></h4></td>
			<td><b><?php echo $game['playtimeAgo'];?></b></td>
		</tr>
		<?php endforeach; ?>
	</table>
Convert ID to 64ID
To convert a steamID to a SteamID64 you can use this call, just send it the id or profile url
$steamwidget = new SteamWidget(); $steamid64 = $steamwidget->get64Id($id);
#LogoGames I OwnPlaytime

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.