truckersmp / steam-api
A steam-api client for Laravel 5. - TruckersMP
Installs: 3 305
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 1
Open Issues: 0
Requires
- php: >=5.5.0
- guzzlehttp/guzzle: ^6.0
- laravel/framework: ^5.0
- nukacode/database: ^1.0
Requires (Dev)
- mockery/mockery: 0.9.3
- orchestra/testbench: ~3.0
- phpunit/phpunit: ~3.0
This package is auto-updated.
Last update: 2024-12-07 03:03:33 UTC
README
For Laravel 4, checkout the documentation on the Laravel 4 branch.
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
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.
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.
php artisan vendor:publish
Usage
Each service from the Steam API has its own methods you can use.
Global
These are methods that are available to each service.
convertId
This will convert the given steam ID to each type of steam ID (64 bit, 32 bit and steam ID3).
Arguments
Possible formats are ID64, id64, 64, ID32, id32, 32, ID3, id3 and 3.
Example usage
Steam::convertId($id, $format);
Example Output: convertId
News
The Steam News web api is used to get articles for games.
Steam::news()
GetNewsForApp
This method will get the news articles for a given app ID. It has three parameters.
Arguments
Example usage
<?php $news = Steam::news()->GetNewsForApp($appId, 5, 500)->newsitems; ?>
Example Output: GetNewsForApp
Player
The Player Service 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
This method will return the level of the Steam user given. It simply returns the integer of their current level.
Example Output: GetSteamLevel
GetPlayerLevelDetails
This will return a Syntax\Containers\Player_Level object with full details for the players level.
Example Output: GetPlayerLevelDetails
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
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
Example Output: GetOwnedGames
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
Example Output: GetRecentlyPlayedGames
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
Example Output: IsPlayingSharedGame
User
The User 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
This will return details on the user from their display name.
Arguments
$player = Steam::user($steamId)->ResolveVanityURL('gabelogannewell');
Example Output: ResolveVanityURL
GetPlayerSummaries
This will return details on one or more users.
Arguments
// One user $steamId = 76561197960287930; $player = Steam::user($steamId)->GetPlayerSummaries()[0]; // Several users $steamIds = [76561197960287930, 76561197968575517] $players = Steam::user($steamIds)->GetPlayerSummaries();
Example Output: GetPlayerSummaries
GetFriendList
Returns the friend list of any Steam user, provided his Steam Community profile visibility is set to "Public".
Arguments
Once the list of friends is gathered, if summaries
is not set to false
; it is passed through GetPlayerSummaries. This allows you to get back a collection of Player objects.
Example Output: GetFriendList
GetPlayerBans
Returns the possible bans placed on the provided steam ID(s).
Arguments
Example Output: GetPlayerBans
User Stats
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 or Steam community ID.
Steam::userStats($steamId)
GetPlayerAchievements
Returns a list of achievements for this user by app ID.
Arguments
Example Output: GetPlayerAchievements
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
Example Output: GetGlobalAchievementPercentagesForApp
GetUserStatsForGame
Returns a list of achievements for this user by app ID.
Arguments
Example Output: GetUserStatsForGame | GetUserStatsForGame (all)
GetSchemaForGame
Returns a list of game details, including achievements and stats.
Arguments
Example Output: GetSchemaForGame
App
This area will get details for games.
Steam::app()
appDetails
This gets all the details for a game. This is most of the information from the store page of a game.
Arguments
Example Output: appDetails
GetAppList
This method will return an array of app objects directly from Steam. It includes the appID and the app name.
Example Output: GetAppList
Package
This method will get details for packages.
Steam::package()
packageDetails
This gets all the details for a package. This is most of the information from the store page of a package.
Arguments
Example Output: packageDetails
Group
This service is used to get details on a Steam group.
Steam::group()
GetGroupSummary
This method will get the details for a group.
Arguments
Example usage
<?php $news = Steam::group()->GetGroupSummary('Valve'); ?>
Example Output: GetGroupSummary