|
| 1 | +# Steam |
| 2 | + |
| 3 | +[](https://travis-ci.org/syntaxerrors/Steam) |
| 4 | +[](https://scrutinizer-ci.com/g/syntaxerrors/Steam/?branch=master) |
| 5 | +[](https://packagist.org/packages/syntax/steam-api) |
| 6 | +[](https://packagist.org/packages/syntax/steam-api) |
| 7 | +[](https://packagist.org/packages/syntax/steam-api) |
| 8 | + |
| 9 | + |
| 10 | +This package provides an easy way to get details from the steam api service. The services it can access are: |
| 11 | + |
| 12 | +- `ISteamNews` |
| 13 | +- `IPlayerService` |
| 14 | +- `ISteamUser` |
| 15 | +- `ISteamUserStats` |
| 16 | +- `ISteamApp` |
| 17 | + |
| 18 | +## Installation |
| 19 | + |
| 20 | +Begin by installing this package with composer. |
| 21 | + |
| 22 | + "require": { |
| 23 | + "syntax/steam-api": "2.0.*" |
| 24 | + } |
| 25 | + |
| 26 | +Next, update composer from the terminal. |
| 27 | + |
| 28 | + composer update syntax/steam-api |
| 29 | + |
| 30 | +> Alternately, you can run "composer require syntax/steam-api:dev-master" from the command line. |
| 31 | +
|
| 32 | +Once that is finished, add the service provider to `config/app.php` |
| 33 | + |
| 34 | + 'Syntax\SteamApi\SteamApiServiceProvider', |
| 35 | + |
| 36 | +> The alias to Steam is already handled by the package. |
| 37 | +
|
| 38 | +Lastly, publish the config file. You can get your API key from [Steam](http://steamcommunity.com/dev/apikey) |
| 39 | + |
| 40 | + php artisan vendor:publish |
| 41 | + |
| 42 | +## Usage |
| 43 | + |
| 44 | +Each service from the steam api has it's own methods you can use. |
| 45 | + |
| 46 | +- [Global](#global) |
| 47 | +- [News](#news) |
| 48 | +- [Player](#player) |
| 49 | +- [User](#user) |
| 50 | +- [User Stats](#user-stats) |
| 51 | +- [App](#app) |
| 52 | +- [Group](#group) |
| 53 | + |
| 54 | +### Global |
| 55 | +These are methods that are available to each service |
| 56 | + |
| 57 | +#### convertId |
| 58 | +This will convert the given steam ID to each type of steam ID (64 bit, 32 bit and steam ID3). |
| 59 | + |
| 60 | +##### Arguments |
| 61 | + |
| 62 | +Name | Type | Description | Required | Default |
| 63 | +-----|------|-------------|----------|--------- |
| 64 | +id| string | The id you want to convert | Yes |
| 65 | +format | string | The format you want back. | No | null |
| 66 | + |
| 67 | +> Possible formats are ID64, id64, 64, ID32, id32, 32, ID3, id3 and 3. |
| 68 | +
|
| 69 | +##### Example usage |
| 70 | + |
| 71 | +```php |
| 72 | +Steam::convertId($id, $format); |
| 73 | +``` |
| 74 | + |
| 75 | +> Example Output: [convertId](./examples/global/convertId.txt) |
| 76 | +
|
| 77 | +### News |
| 78 | +The [Steam News](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetNewsForApp_.28v0002.29) web api is used to get articles for games. |
| 79 | + |
| 80 | +```php |
| 81 | +Steam::news() |
| 82 | +``` |
| 83 | + |
| 84 | +#### GetNewsForApp |
| 85 | +This method will get the news articles for a given app id. It has three parameters. |
| 86 | + |
| 87 | +##### Arguments |
| 88 | + |
| 89 | +Name | Type | Description | Required | Default |
| 90 | +-----|------|-------------|----------|--------- |
| 91 | +appId| int | The id for the app you want news on | Yes |
| 92 | +count | int | The number of news items to return | No | 5 |
| 93 | +maxlength | int | The maximum number of characters to return | No | null |
| 94 | + |
| 95 | +##### Example usage |
| 96 | + |
| 97 | +```php |
| 98 | +<?php |
| 99 | + $news = Steam::news()->GetNewsForApp($appId, 5, 500)->newsitems; |
| 100 | +?> |
| 101 | +``` |
| 102 | + |
| 103 | +> Example Output: [GetNewsForApp](./examples/news/GetNewsForApp.txt) |
| 104 | +
|
| 105 | +### Player |
| 106 | +The [Player Service](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29) is used to get details on players. |
| 107 | + |
| 108 | +When instantiating the player class, you are required to pass a steamId or steam community ID. |
| 109 | + |
| 110 | +```php |
| 111 | +Steam::player($steamId) |
| 112 | +``` |
| 113 | + |
| 114 | +#### GetSteamLevel |
| 115 | +This method will return the level of the steam user given. It simply returns the integer of their current level. |
| 116 | + |
| 117 | + |
| 118 | +> Example Output: [GetSteamLevel](./examples/player/GetSteamLevel.txt) |
| 119 | +
|
| 120 | +#### GetPlayerLevelDetails |
| 121 | +This will return a Syntax\Containers\Player_Level object with full details for the players level. |
| 122 | + |
| 123 | + |
| 124 | +> Example Output: [GetPlayerLevelDetails](./examples/player/GetPlayerLevelDetails.txt) |
| 125 | +
|
| 126 | +#### GetBadges |
| 127 | +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. |
| 128 | + |
| 129 | + |
| 130 | +> Example Output: [GetBadges](./examples/player/GetBadges.txt) |
| 131 | +
|
| 132 | +#### GetOwnedGames |
| 133 | +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). |
| 134 | + |
| 135 | +##### Arguments |
| 136 | + |
| 137 | +Name | Type | Description | Required | Default |
| 138 | +-----|------|-------------|----------|--------- |
| 139 | +includeAppInfo| boolean | Whether or not to include game details | No | true |
| 140 | +includePlayedFreeGames | boolean | Whether or not to include free games | No | false |
| 141 | +appIdsFilter | array | An array of appIds. These will be the only ones returned if the user has them | No | array() |
| 142 | + |
| 143 | + |
| 144 | +> Example Output: [GetOwnedGames](./examples/player/GetOwnedGames.txt) |
| 145 | +
|
| 146 | +#### GetRecentlyPlayedGames |
| 147 | +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). |
| 148 | + |
| 149 | +##### Arguments |
| 150 | + |
| 151 | +Name | Type | Description | Required | Default |
| 152 | +-----|------|-------------|----------|--------- |
| 153 | +count| int | The number of games to return | No | null |
| 154 | + |
| 155 | +> Example Output: [GetRecentlyPlayedGames](./examples/player/GetRecentlyPlayedGames.txt) |
| 156 | +
|
| 157 | +#### IsPlayingSharedGame |
| 158 | +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. |
| 159 | + |
| 160 | +##### Arguments |
| 161 | + |
| 162 | +Name | Type | Description | Required | Default |
| 163 | +-----|------|-------------|----------|--------- |
| 164 | +appId| int | The game to check for | Yes | |
| 165 | + |
| 166 | + |
| 167 | +> Example Output: [IsPlayingSharedGame](./examples/player/IsPlayingSharedGame.txt) |
| 168 | +
|
| 169 | +### User |
| 170 | +The [User](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_.28v0001.29) WebAPI call is used to get details about the user specifically. |
| 171 | + |
| 172 | +When instantiating the user class, you are required to pass a steamId or steam community ID. |
| 173 | + |
| 174 | +```php |
| 175 | +Steam::user($steamId) |
| 176 | +``` |
| 177 | + |
| 178 | +#### GetPlayerSummaries |
| 179 | +This will return details on the user. |
| 180 | + |
| 181 | +##### Arguments |
| 182 | + |
| 183 | +Name | Type | Description | Required | Default |
| 184 | +-----|------|-------------|----------|--------- |
| 185 | +steamId| int[] | An array of (or singular) steam id(s) to get details for | No | Steam id passed to user() |
| 186 | + |
| 187 | +```php |
| 188 | + $player = Steam::user($steamId)->GetPlayerSummaries()[0]; |
| 189 | +``` |
| 190 | + |
| 191 | +> Example Output: [GetPlayerSummaries](./examples/user/GetPlayerSummaries.txt) |
| 192 | +
|
| 193 | +#### GetFriendList |
| 194 | +Returns the friend list of any Steam user, provided his Steam Community profile visibility is set to "Public". |
| 195 | + |
| 196 | +##### Arguments |
| 197 | + |
| 198 | +Name | Type | Description | Required | Default |
| 199 | +-----|------|-------------|----------|--------- |
| 200 | +relationship| string (all or friend) | The type of friends to get | No | all |
| 201 | + |
| 202 | +Once the list of friends is gathered, it is passed through [GetPlayerSummaries](#GetPlayerSummaries). This allows you to get back a collection of Player objects. |
| 203 | + |
| 204 | + |
| 205 | +> Example Output: [GetFriendList](./examples/user/GetFriendList.txt) |
| 206 | +
|
| 207 | +#### GetPlayerBans |
| 208 | +Returns the possible bans placed on the provided steam ID(s). |
| 209 | + |
| 210 | +##### Arguments |
| 211 | + |
| 212 | +Name | Type | Description | Required | Default |
| 213 | +-----|------|-------------|----------|--------- |
| 214 | +steamId| int[] | An array of (or singular) steam id(s) to get details for | No | Steam id passed to user() |
| 215 | + |
| 216 | + |
| 217 | +> Example Output: [GetPlayerBans](./examples/user/GetPlayerBans.txt) |
| 218 | +
|
| 219 | +### User Stats |
| 220 | +The [User Stats](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetPlayerAchievements_.28v0001.29) WebAPI call is used to get details about a user's gaming. |
| 221 | + |
| 222 | +When instantiating the user stats class, you are required to pass a steamId or steam community ID. |
| 223 | + |
| 224 | +```php |
| 225 | +Steam::userStats($steamId) |
| 226 | +``` |
| 227 | + |
| 228 | +#### GetPlayerAchievements |
| 229 | +Returns a list of achievements for this user by app id. |
| 230 | + |
| 231 | +##### Arguments |
| 232 | + |
| 233 | +Name | Type | Description | Required | Default |
| 234 | +-----|------|-------------|----------|--------- |
| 235 | +appId| int | The id of the game you want the user's achievements in | Yes | |
| 236 | + |
| 237 | + |
| 238 | +> Example Output: [GetPlayerAchievements](./examples/user/stats/GetPlayerAchievements.txt) |
| 239 | +
|
| 240 | +#### GetGlobalAchievementPercentagesForApp |
| 241 | +This method will return a list of all chievements for the specified game and the percentage that each achievement has been unlocked. |
| 242 | + |
| 243 | +##### Arguments |
| 244 | + |
| 245 | +Name | Type | Description | Required | Default |
| 246 | +-----|------|-------------|----------|--------- |
| 247 | +appId| int | The id of the game you want the user's achievements in | Yes | |
| 248 | + |
| 249 | + |
| 250 | +> Example Output: [GetGlobalAchievementPercentagesForApp](./examples/user/stats/GetGlobalAchievementPercentageForApp.txt) |
| 251 | +
|
| 252 | +#### GetUserStatsForGame |
| 253 | +Returns a list of achievements for this user by app id. |
| 254 | + |
| 255 | +##### Arguments |
| 256 | + |
| 257 | +Name | Type | Description | Required | Default |
| 258 | +-----|------|-------------|----------|--------- |
| 259 | +appId| int | The id of the game you want the user's achievements in | Yes | |
| 260 | + |
| 261 | + |
| 262 | +> Example Output: [GetUserStatsForGame](./examples/user/stats/GetUserStatsForGame.txt) |
| 263 | +
|
| 264 | +### App |
| 265 | +This area will get details for games. |
| 266 | + |
| 267 | +```php |
| 268 | +Steam::app() |
| 269 | +``` |
| 270 | + |
| 271 | +#### appDetails |
| 272 | +This gets all the details for a game. This is most of the infomation from the store page of a game. |
| 273 | + |
| 274 | +##### Arguments |
| 275 | + |
| 276 | +Name | Type | Description | Required | Default |
| 277 | +-----|------|-------------|----------|--------- |
| 278 | +appIds| int[] | The ids of the games you want details for | Yes | |
| 279 | + |
| 280 | + |
| 281 | +> Example Output: [appDetails](./examples/app/appDetails.txt) |
| 282 | +
|
| 283 | +#### GetAppList |
| 284 | +This method will return an array of app objects directly from steam. It includes the appId and the app name. |
| 285 | + |
| 286 | +> Example Output: [GetAppList](./examples/app/GetAppList.txt) |
| 287 | +
|
| 288 | +### Group |
| 289 | +This service is used to get details on a steam group. |
| 290 | + |
| 291 | +```php |
| 292 | +Steam::group() |
| 293 | +``` |
| 294 | + |
| 295 | +#### GetGroupSummary |
| 296 | +This method will get the details for a group. |
| 297 | + |
| 298 | +##### Arguments |
| 299 | + |
| 300 | +Name | Type | Description | Required | Default |
| 301 | +-----|------|-------------|----------|--------- |
| 302 | +group| string or int | The id or the name of the group. | Yes |
| 303 | + |
| 304 | +##### Example usage |
| 305 | + |
| 306 | +```php |
| 307 | +<?php |
| 308 | + $news = Steam::group()->GetGroupSummary('Valve'); |
| 309 | +?> |
| 310 | +``` |
| 311 | + |
| 312 | +> Example Output: [GetGroupSummary](./examples/group/GetGroupSummary.txt) |
0 commit comments