1. Go to this page and download the library: Download fkrzski/php-steam-api-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
fkrzski / php-steam-api-sdk example snippets
use Fkrzski\SteamApiSdk\Http\Requests\GetPlayerSummariesRequest;
use Fkrzski\SteamApiSdk\SteamConfig;
use Fkrzski\SteamApiSdk\SteamConnector;
use Fkrzski\SteamApiSdk\ValueObjects\SteamId;
$connector = new SteamConnector(new SteamConfig(apiKey: 'YOUR_STEAM_API_KEY'));
$summaries = $connector
->send(new GetPlayerSummariesRequest([SteamId::fromSteamId64('76561198000000000')]))
->dto();
echo $summaries[0]->personaName;
use Fkrzski\SteamApiSdk\ValueObjects\SteamId;
// Strict — throws InvalidSteamIdException when the input is not a 17-digit numeric ID.
$id = SteamId::fromSteamId64('76561198000000000');
// Lenient — returns null when the input is not a SteamID64 or /profiles/<id> URL.
$id = SteamId::tryFromInput('https://steamcommunity.com/profiles/76561198000000000');
// Extract the slug from /id/<name> URLs (or trim raw input). Resolve it via ResolveVanityUrlRequest.
$vanity = SteamId::extractVanityName('https://steamcommunity.com/id/gabelogannewell/');
use Fkrzski\SteamApiSdk\Exceptions\SteamUserNotFoundException;
use Fkrzski\SteamApiSdk\Http\Requests\ResolveVanityUrlRequest;
try {
$steamId = $connector->send(new ResolveVanityUrlRequest('gabelogannewell'))->dto();
} catch (SteamUserNotFoundException) {
// The vanity slug does not exist.
}
use Fkrzski\SteamApiSdk\Exceptions\TooManySteamIdsException;
use Fkrzski\SteamApiSdk\Http\Requests\GetPlayerSummariesRequest;
$summaries = $connector->send(new GetPlayerSummariesRequest([$steamId]))->dto();
foreach ($summaries as $summary) {
echo $summary->personaName, ' — ', $summary->profileUrl, PHP_EOL;
}
use Fkrzski\SteamApiSdk\Exceptions\ProfileNotPublicException;
use Fkrzski\SteamApiSdk\Http\Requests\GetOwnedGamesRequest;
try {
$library = $connector->send(new GetOwnedGamesRequest(
steamId: $steamId,
appIdsFilter: [381210], // optional
use Fkrzski\SteamApiSdk\SteamConfig;
use Fkrzski\SteamApiSdk\SteamConnector;
use Saloon\RateLimitPlugin\Stores\PredisStore;
$connector = new SteamConnector(new SteamConfig(
apiKey: 'YOUR_STEAM_API_KEY',
rateLimitStore: new PredisStore($predis),
));
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.