forked from syntaxerrors/Steam
-
Notifications
You must be signed in to change notification settings - Fork 0
Laravel Integration
TeemoCell edited this page Jul 20, 2026
·
2 revisions
Laravel package discovery registers TeemoCell\SteamWebApi\SteamApiServiceProvider. The provider binds TeemoCell\SteamWebApi\Client as a singleton and also registers the steam-api container alias.
Constructor injection is the recommended Laravel integration:
<?php
namespace App\Http\Controllers;
use TeemoCell\SteamWebApi\Client;
final class SteamProfileController
{
public function __invoke(Client $steam, string $steamId)
{
return $steam->user($steamId)->GetPlayerSummaries();
}
}The singleton receives the key configured in steam-api.steamApiKey.
The facade remains available for applications that prefer it:
use TeemoCell\SteamWebApi\Facades\SteamApi;
$games = SteamApi::player($steamId)->GetOwnedGames();Dependency injection is easier to replace in unit tests and makes dependencies explicit.
Publish the configuration when it needs to be customized:
php artisan vendor:publish --provider="TeemoCell\SteamWebApi\SteamApiServiceProvider"Set the API key in .env:
STEAM_API_KEY=your-key-hereSee Configuration for custom Guzzle clients and publisher-key handling.
Documentation for teemocell/steam-web-api · Licensed under the MIT License