PHPackages                             pmzedx/steam-service - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. pmzedx/steam-service

ActiveLibrary[HTTP &amp; Networking](/categories/http)

pmzedx/steam-service
====================

A clean PHP wrapper for the Steam Web API using Guzzle HTTP.

v1.0.1(1mo ago)11MITPHP ^8.0

Since Jun 21Compare

[ Source](https://github.com/peimanmahdavi/SteamService)[ Packagist](https://packagist.org/packages/pmzedx/steam-service)[ RSS](/packages/pmzedx-steam-service/feed)WikiDiscussions Synced 2w ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

Steam API PHP
=============

[](#steam-api-php)

A clean, well-documented PHP wrapper for the Steam Web API built on top of Guzzle HTTP.

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

[](#installation)

```
composer require pmzedx/steam-service
```

Getting an API Key
------------------

[](#getting-an-api-key)

Request a Steam Web API key at:

Setup
-----

[](#setup)

### Option 1 — Environment variable (recommended)

[](#option-1--environment-variable-recommended)

Set `STEAM_API_KEY` in your `.env` or server environment:

```
STEAM_API_KEY=your_key_here

```

Then create the client with no arguments:

```
use PmZedx\SteamService\SteamClient;

$steam = new SteamClient();
```

### Option 2 — Pass the key directly

[](#option-2--pass-the-key-directly)

```
$steam = new SteamClient('your_api_key_here');
```

---

Usage
-----

[](#usage)

### 👤 User Profiles — `$steam->users()`

[](#-user-profiles--steam-users)

```
// Single profile
$data = $steam->users()->getProfiles('76561197960435530');
$player = $data['response']['players'][0];
echo $player['personaname']; // Display name
echo $player['avatarfull'];  // Avatar URL

// Multiple profiles (up to 100)
$data = $steam->users()->getProfiles([
    '76561197960435530',
    '76561197960287930',
]);

// Friend list
$data = $steam->users()->getFriends('76561197960435530');
foreach ($data['friendslist']['friends'] as $friend) {
    echo $friend['steamid'];
}
```

---

### 🎮 Player Games — `$steam->player()`

[](#-player-games--steam-player)

```
// All owned games
$data = $steam->player()->getOwnedGames('76561197960435530');
echo $data['response']['game_count'];

// With options
$data = $steam->player()->getOwnedGames(
    steamId: '76561197960435530',
    includeGameDetails: true,
    includeFreeGames: true,
    filterToAppIds: [440, 730] // Only TF2 and CS2
);

// Recently played (last 2 weeks)
$data = $steam->player()->getRecentlyPlayedGames('76561197960435530', limit: 5);
foreach ($data['response']['games'] as $game) {
    echo $game['name'] . ': ' . $game['playtime_2weeks'] . ' minutes';
}
```

---

### 🏆 Achievements &amp; Stats — `$steam->userStats()`

[](#-achievements--stats--steam-userstats)

```
// Global achievement unlock rates for a game (no auth needed)
$data = $steam->userStats()->getGlobalAchievementPercentages(440);
foreach ($data['achievementpercentages']['achievements'] as $a) {
    echo $a['name'] . ': ' . $a['percent'] . '%';
}

// A player's achievement status in a game
$data = $steam->userStats()->getPlayerAchievements('76561197960435530', 440, language: 'en');
foreach ($data['playerstats']['achievements'] as $a) {
    echo $a['name'] . ': ' . ($a['achieved'] ? '✅' : '❌');
}

// A player's in-game stats
$data = $steam->userStats()->getPlayerStats('76561197960435530', 440);
foreach ($data['playerstats']['stats'] as $stat) {
    echo $stat['name'] . ': ' . $stat['value'];
}
```

---

### 📰 Game News — `$steam->news()`

[](#-game-news--steam-news)

```
$data = $steam->news()->getForGame(appId: 440, count: 5, maxLength: 300);
foreach ($data['appnews']['newsitems'] as $article) {
    echo $article['title'] . "\n" . $article['url'];
}
```

---

Error Handling
--------------

[](#error-handling)

All methods throw `SteamApiException` on failure (bad key, rate limit, network error, etc.):

```
use PmZedx\SteamService\Exceptions\SteamApiException;

try {
    $data = $steam->users()->getProfiles('76561197960435530');
} catch (SteamApiException $e) {
    echo 'Steam API error: ' . $e->getMessage();
}
```

---

Package Structure
-----------------

[](#package-structure)

```
src/
├── SteamClient.php              ← Main entry point
├── Concerns/
│   └── MakesHttpRequests.php    ← Guzzle HTTP trait (shared by all resources)
├── Exceptions/
│   └── SteamApiException.php    ← Thrown on all API/network errors
└── Resources/
    ├── NewsResource.php         ← ISteamNews
    ├── UserResource.php         ← ISteamUser
    ├── PlayerResource.php       ← IPlayerService
    └── UserStatsResource.php    ← ISteamUserStats

```

License
-------

[](#license)

MIT

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance91

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~3 days

Total

2

Last Release

42d ago

PHP version history (2 changes)v1.0.0PHP ^8.5

v1.0.1PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/7feeca27df8ddb05ed8019001f547c0da7b31e69460a8071e72b9d2f9f052b15?d=identicon)[peimanmahdavi](/maintainers/peimanmahdavi)

---

Tags

apiGuzzlesteamvalvesteam api

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/pmzedx-steam-service/health.svg)

```
[![Health](https://phpackages.com/badges/pmzedx-steam-service/health.svg)](https://phpackages.com/packages/pmzedx-steam-service)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.2k555.0M2.8k](/packages/aws-aws-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

293.1k](/packages/eslazarev-wildberries-sdk)[spatie/crawler

Crawl all internal links found on a website

2.8k19.3M71](/packages/spatie-crawler)[guzzlehttp/oauth-subscriber

Guzzle OAuth 1.0 subscriber

24215.8M157](/packages/guzzlehttp-oauth-subscriber)[guzzlehttp/guzzle-services

Provides an implementation of the Guzzle Command library that uses Guzzle service descriptions to describe web services, serialize requests, and parse responses into easy to use model structures.

25711.2M193](/packages/guzzlehttp-guzzle-services)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

37234.5k2](/packages/onesignal-onesignal-php-api)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
