PHPackages                             truckersmp/steam-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. truckersmp/steam-api

ActiveLibrary[API Development](/categories/api)

truckersmp/steam-api
====================

A steam-api client for Laravel 5. - TruckersMP

2.0.16.2(5y ago)03.3k1MITPHPPHP &gt;=5.5.0

Since Dec 3Pushed 5y ago1 watchersCompare

[ Source](https://github.com/TruckersMP/steam-old)[ Packagist](https://packagist.org/packages/truckersmp/steam-api)[ RSS](/packages/truckersmp-steam-api/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (6)Versions (2)Used By (0)

Steam
=====

[](#steam)

[![Join the chat at https://gitter.im/truckersmp/Steam](https://camo.githubusercontent.com/abe08b740a4156153736f791393ec4da6619c4be73212e75769f52edacc0e2b5/68747470733a2f2f6261646765732e6769747465722e696d2f4a6f696e253230436861742e737667)](https://gitter.im/truckersmp/Steam?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

[![Build Status](https://camo.githubusercontent.com/efeca715b0150409335e723fabef76692ff29b09e58b509ede0580c0a8cdb3b1/68747470733a2f2f7472617669732d63692e6f72672f747275636b6572736d702f537465616d2e737667)](https://travis-ci.org/truckersmp/Steam)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/acf2d804511ec51f20fac9b1435169162cb1623b316432607f84c2320fc8453d/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f747275636b6572736d702f537465616d2f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/truckersmp/Steam/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/5e0a614acbd5e91689dba26a42d118c2ed343dabbff2289c8f20a9bab63daf98/68747470733a2f2f706f7365722e707567782e6f72672f747275636b6572736d702f737465616d2d6170692f762f737461626c652e737667)](https://packagist.org/packages/truckersmp/steam-api)[![Total Downloads](https://camo.githubusercontent.com/c310d13a3f88862b058fadb78ad7b5cad918352114af43ef574834bab4d0ffb6/68747470733a2f2f706f7365722e707567782e6f72672f747275636b6572736d702f737465616d2d6170692f646f776e6c6f6164732e737667)](https://packagist.org/packages/truckersmp/steam-api)[![License](https://camo.githubusercontent.com/9261a4da1be6c27a0318817744015fda763fb39a3dcecd60f569551eb84bf4c3/68747470733a2f2f706f7365722e707567782e6f72672f747275636b6572736d702f737465616d2d6170692f6c6963656e73652e737667)](https://packagist.org/packages/truckersmp/steam-api)

**For Laravel 4, checkout the documentation on the [Laravel 4 branch](https://github.com/truckersmp/Steam/tree/Laravel4).**

- [Installation](#installation)
- [Usage](#usage)
- [Contributors](#contributors)

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`

Installation
------------

[](#installation)

Begin by installing this package with composer.

```
"require": {
	"truckersmp/steam-api": "2.0.*"
}

```

Next, update composer from the terminal.

```
composer update truckersmp/steam-api

```

> Alternately, you can run "composer require truckersmp/steam-api:dev-master" from the command line.

> **Note**: If you are using Laravel 5.5, the next steps are unnecessary. This package supports Laravel [Package Discovery](https://laravel.com/docs/5.5/packages#package-discovery).

Once that is finished, add the service provider to `config/app.php`

```
'Syntax\SteamApi\SteamApiServiceProvider',

```

> The alias to Steam is already handled by the package.

Lastly, publish the config file. You can get your API key from [Steam](https://steamcommunity.com/dev/apikey).

```
php artisan vendor:publish

```

Usage
-----

[](#usage)

Each service from the Steam API has its own methods you can use.

- [Global](#global)
- [News](#news)
- [Player](#player)
- [User](#user)
- [User Stats](#user-stats)
- [App](#app)
- [Package](#package)
- [Group](#group)

### Global

[](#global)

These are methods that are available to each service.

#### convertId

[](#convertid)

This will convert the given steam ID to each type of steam ID (64 bit, 32 bit and steam ID3).

##### Arguments

[](#arguments)

NameTypeDescriptionRequiredDefaultidstringThe id you want to convertYesformatstringThe format you want back.Nonull> Possible formats are ID64, id64, 64, ID32, id32, 32, ID3, id3 and 3.

##### Example usage

[](#example-usage)

```
Steam::convertId($id, $format);
```

> Example Output: [convertId](./examples/global/convertId.txt)

### News

[](#news)

The [Steam News](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetNewsForApp_.28v0002.29) web api is used to get articles for games.

```
Steam::news()
```

#### GetNewsForApp

[](#getnewsforapp)

This method will get the news articles for a given app ID. It has three parameters.

##### Arguments

[](#arguments-1)

NameTypeDescriptionRequiredDefaultappIdintThe id for the app you want news onYescountintThe number of news items to returnNo5maxlengthintThe maximum number of characters to returnNonull##### Example usage

[](#example-usage-1)

```

```

> Example Output: [GetNewsForApp](./examples/news/GetNewsForApp.txt)

### Player

[](#player)

The [Player Service](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetOwnedGames_.28v0001.29) is used to get details on players.

When instantiating the player class, you are required to pass a steamId or Steam community ID.

```
Steam::player($steamId)
```

#### GetSteamLevel

[](#getsteamlevel)

This method will return the level of the Steam user given. It simply returns the integer of their current level.

> Example Output: [GetSteamLevel](./examples/player/GetSteamLevel.txt)

#### GetPlayerLevelDetails

[](#getplayerleveldetails)

This will return a Syntax\\Containers\\Player\_Level object with full details for the players level.

> Example Output: [GetPlayerLevelDetails](./examples/player/GetPlayerLevelDetails.txt)

#### GetBadges

[](#getbadges)

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](./examples/player/GetBadges.txt)

#### GetOwnedGames

[](#getownedgames)

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 (i.e. the WebAPI key you are using is linked to the steamID you are requesting).

##### Arguments

[](#arguments-2)

NameTypeDescriptionRequiredDefaultincludeAppInfobooleanWhether or not to include game detailsNotrueincludePlayedFreeGamesbooleanWhether or not to include free gamesNofalseappIdsFilterarrayAn array of appIds. These will be the only ones returned if the user has themNoarray()> Example Output: [GetOwnedGames](./examples/player/GetOwnedGames.txt)

#### GetRecentlyPlayedGames

[](#getrecentlyplayedgames)

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 (i.e. the WebAPI key you are using is linked to the steamID you are requesting).

##### Arguments

[](#arguments-3)

NameTypeDescriptionRequiredDefaultcountintThe number of games to returnNonull> Example Output: [GetRecentlyPlayedGames](./examples/player/GetRecentlyPlayedGames.txt)

#### IsPlayingSharedGame

[](#isplayingsharedgame)

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.

##### Arguments

[](#arguments-4)

NameTypeDescriptionRequiredDefaultappIdintThe game to check forYes> Example Output: [IsPlayingSharedGame](./examples/player/IsPlayingSharedGame.txt)

### User

[](#user)

The [User](https://developer.valvesoftware.com/wiki/Steam_Web_API#GetFriendList_.28v0001.29) WebAPI call is used to get details about the user specifically.

When instantiating the user class, you are required to pass at least one steamId or steam community ID.

```
Steam::user($steamId)
```

#### ResolveVanityURL

[](#resolvevanityurl)

This will return details on the user from their display name.

##### Arguments

[](#arguments-5)

NameTypeDescriptionRequiredDefaultdisplayNamestringThe display name to get the steam ID for. In `https://steamcommunity.com/id/gabelogannewell` it would be `gabelogannewell`.YesNULL```
	$player = Steam::user($steamId)->ResolveVanityURL('gabelogannewell');
```

> Example Output: [ResolveVanityURL](./examples/user/ResolveVanityURL.txt)

#### GetPlayerSummaries

[](#getplayersummaries)

This will return details on one or more users.

##### Arguments

[](#arguments-6)

NameTypeDescriptionRequiredDefaultsteamIdint\[\]An array of (or singular) steam ID(s) to get details forNoSteam ID passed to user()```
	// One user
	$steamId = 76561197960287930;
	$player = Steam::user($steamId)->GetPlayerSummaries()[0];

	// Several users
	$steamIds = [76561197960287930, 76561197968575517]
	$players = Steam::user($steamIds)->GetPlayerSummaries();
```

> Example Output: [GetPlayerSummaries](./examples/user/GetPlayerSummaries.txt)

#### GetFriendList

[](#getfriendlist)

Returns the friend list of any Steam user, provided his Steam Community profile visibility is set to "Public".

##### Arguments

[](#arguments-7)

NameTypeDescriptionRequiredDefaultrelationshipstring (all or friend)The type of friends to getNoallsummariesbool (true or false)To return the friend player summaries, or only steamIdsNotrueOnce the list of friends is gathered, if `summaries` is not set to `false`; it is passed through [GetPlayerSummaries](#GetPlayerSummaries). This allows you to get back a collection of Player objects.

> Example Output: [GetFriendList](./examples/user/GetFriendList.txt)

#### GetPlayerBans

[](#getplayerbans)

Returns the possible bans placed on the provided steam ID(s).

##### Arguments

[](#arguments-8)

NameTypeDescriptionRequiredDefaultsteamIdint\[\]An array of (or singular) steam id(s) to get details forNoSteam id passed to user()> Example Output: [GetPlayerBans](./examples/user/GetPlayerBans.txt)

### User Stats

[](#user-stats)

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.

When instantiating the user stats class, you are required to pass a steamID or Steam community ID.

```
Steam::userStats($steamId)
```

#### GetPlayerAchievements

[](#getplayerachievements)

Returns a list of achievements for this user by app ID.

##### Arguments

[](#arguments-9)

NameTypeDescriptionRequiredDefaultappIdintThe id of the game you want the user's achievements inYes> Example Output: [GetPlayerAchievements](./examples/user/stats/GetPlayerAchievements.txt)

#### GetGlobalAchievementPercentagesForApp

[](#getglobalachievementpercentagesforapp)

This method will return a list of all achievements for the specified game and the percentage of all users that have unlocked each achievement.

##### Arguments

[](#arguments-10)

NameTypeDescriptionRequiredDefaultappIdintThe ID of the game you want the user's achievements inYes> Example Output: [GetGlobalAchievementPercentagesForApp](./examples/user/stats/GetGlobalAchievementPercentageForApp.txt)

#### GetUserStatsForGame

[](#getuserstatsforgame)

Returns a list of achievements for this user by app ID.

##### Arguments

[](#arguments-11)

NameTypeDescriptionRequiredDefaultappIdintThe ID of the game you want the user's achievements inYesallbooleanIf you want all stats and not just the achievements set to true.NoFALSE> Example Output: [GetUserStatsForGame](./examples/user/stats/GetUserStatsForGame.txt) | [GetUserStatsForGame (all)](./examples/user/stats/GetUserStatsForGameAll.txt)

#### GetSchemaForGame

[](#getschemaforgame)

Returns a list of game details, including achievements and stats.

##### Arguments

[](#arguments-12)

NameTypeDescriptionRequiredDefaultappIdintThe ID of the game you want the details for.Yes> Example Output: [GetSchemaForGame](./examples/user/stats/GetSchemaForGame.txt)

### App

[](#app)

This area will get details for games.

```
Steam::app()
```

#### appDetails

[](#appdetails)

This gets all the details for a game. This is most of the information from the store page of a game.

##### Arguments

[](#arguments-13)

NameTypeDescriptionRequiredDefaultappIdsint\[\]The ids of the games you want details forYesccstringThe cc is the country code, you can get appropriate currency values according to [ISO 3166-1](https://wikipedia.org/wiki/ISO_3166-1_alpha-2#Officially_assigned_code_elements)NolstringThe l is the language parameter, you can get the appropriate language according to [ISO 639-1](https://wikipedia.org/wiki/List_of_ISO_639-1_codes)No> Example Output: [appDetails](./examples/app/appDetails.txt)

#### GetAppList

[](#getapplist)

This method will return an array of app objects directly from Steam. It includes the appID and the app name.

> Example Output: [GetAppList](./examples/app/GetAppList.txt)

### Package

[](#package)

This method will get details for packages.

```
Steam::package()
```

#### packageDetails

[](#packagedetails)

This gets all the details for a package. This is most of the information from the store page of a package.

##### Arguments

[](#arguments-14)

NameTypeDescriptionRequiredDefaultpackIdsint\[\]The ids of the packages you want details forYesccstringThe cc is the country code, you can get appropriate currency values according to [ISO 3166-1](https://wikipedia.org/wiki/ISO_3166-1)NolstringThe l is the language parameter, you can get the appropriate language according to [ISO 639-1](https://wikipedia.org/wiki/ISO_639-1) (If there is one)No> Example Output: [packageDetails](./examples/package/packageDetails.txt)

### Group

[](#group)

This service is used to get details on a Steam group.

```
Steam::group()
```

#### GetGroupSummary

[](#getgroupsummary)

This method will get the details for a group.

##### Arguments

[](#arguments-15)

NameTypeDescriptionRequiredDefaultgroupstring or intThe ID or the name of the group.Yes##### Example usage

[](#example-usage-2)

```
