This fork aims to provide the extra services to the Steam client such as Steam economy and Microtransactions.
This package provides an easy way to get details from the steam api service. The services it can access are:
ISteamNews
IPlayerService
ISteamUser
ISteamUserStats
ISteamApp
Begin by installing this package with composer.
"require": {
"abyssalarts/steam-api": "dev-master"
}
Next, update composer from the terminal.
composer update abyssalarts/steam-api
Alternately, you can run "composer require abyssalarts/steam-api:dev-master" from the command line.
Once that is finished, add the service provider to app/config/app.php
'AbyssalArts\SteamApi\SteamApiServiceProvider',
The alias to Steam is already handled by the package.
Publish the config file. You can get your API key from Steam
php artisan config:publish abyssalarts/steam-api
Run the migrations.
php artisan migrate --package="abyssalarts/steam-api"
Each service from the steam api has it's own methods you can use.
The Steam News web api is used to get articles for games.
Steam::news()
This method will get the news articles for a given app id. It has three parameters.
Name | Type | Description | Required | Default |
---|---|---|---|---|
appId | int | The id for the app you want news on | Yes | |
count | int | The number of news items to return | No | 5 |
maxlength | int | The maximum number of characters to return | No | null |
<?php
$news = Steam::news()->GetNewsForApp($appId, 5, 500)->newsitems;
?>
Example Output: GetNewsForApp
The Player Service is used to get details on players.
When instantiating the player class, you are required to pass a steamId.
Steam::player($steamId)
This method will return the level of the steam user given. It simply returns the integer of their current level.
Example Output: GetSteamLevel
This will return a AbyssalArts\Containers\Player_Level object with full details for the players level.
Example Output: GetPlayerLevelDetails
This call will give you a list of the badges that the player currently has. There is currently no schema for badges so all you will get is the id and details.
Example Output: GetBadges
GetOwnedGames returns a list of games a player owns along with some playtime information, if the profile is publicly visible. Private, friends-only, and other privacy settings are not supported unless you are asking for your own personal details (ie the WebAPI key you are using is linked to the steamid you are requesting).
Name | Type | Description | Required | Default |
---|---|---|---|---|
includeAppInfo | boolean | Whether or not to include game details | No | true |
includePlayedFreeGames | boolean | Whether or not to include free games | No | false |
appIdsFilter | array | An array of appIds. These will be the only ones returned if the user has them | No | array() |
Example Output: GetOwnedGames
GetRecentlyPlayedGames returns a list of games a player has played in the last two weeks, if the profile is publicly visible. Private, friends-only, and other privacy settings are not supported unless you are asking for your own personal details (ie the WebAPI key you are using is linked to the steamid you are requesting).
Name | Type | Description | Required | Default |
---|---|---|---|---|
count | int | The number of games to return | No | null |
Example Output: GetRecentlyPlayedGames
IsPlayingSharedGame returns the original owner's SteamID if a borrowing account is currently playing this game. If the game is not borrowed or the borrower currently doesn't play this game, the result is always 0.
Name | Type | Description | Required | Default |
---|---|---|---|---|
appId | int | The game to check for | Yes |
Example Output: IsPlayingSharedGame
The User WebAPI call is used to get details about the user specifically.
When instantiating the user class, you are required to pass a steamId.
Steam::user($steamId)
This will return details on the user.
Name | Type | Description | Required | Default |
---|---|---|---|---|
steamId | int[] | An array of (or singular) steam id(s) to get details for | No | Steam id passed to user() |
$player = Steam::user($steamId)->GetPlayerSummaries()[0];
Example Output: GetPlayerSummaries
Returns the friend list of any Steam user, provided his Steam Community profile visibility is set to "Public".
Name | Type | Description | Required | Default |
---|---|---|---|---|
relationship | string (all or friend) | The type of friends to get | No | all |
Once the list of friends is gathered, it is passed through GetPlayerSummaries. This allows you to get back a collection of Player objects.
Example Output: GetFriendList
The User Stats WebAPI call is used to get details about a user's gaming.
When instantiating the user stats class, you are required to pass a steamId.
Steam::userStats($steamId)
Returns a list of achievements for this user by app id.
Name | Type | Description | Required | Default |
---|---|---|---|---|
appId | int | The id of the game you want the user's achievements in | Yes |
Example Output: GetPlayerAchievements
This method will return a list of all chievements for the specified game and the percentage that each achievement has been unlocked.
Name | Type | Description | Required | Default |
---|---|---|---|---|
appId | int | The id of the game you want the user's achievements in | Yes |
Example Output: GetGlobalAchievementPercentagesForApp
Returns a list of achievements that the user has completed for this user by app id.
Name | Type | Description | Required | Default |
---|---|---|---|---|
appId | int | The id of the game you want the user's achievements in | Yes |
Example Output: GetUserStatsForGame
This area will get details for games.
Steam::app()
This gets all the details for a game. This is most of the infomation from the store page of a game.
Name | Type | Description | Required | Default |
---|---|---|---|---|
appIds | int[] | The ids of the games you want details for | Yes |
Example Output: appDetails
This method will return an array of app objects directly from steam. It includes the appId and the app name.
Example Output: GetAppList
- Add container for news items
- Add container for player badges
- Change achievement stats from array to collection Stats/GetGlobalAchievementPercentagesForApp