duelistrage/laravel-steam-auth
Composer 安装命令:
composer require duelistrage/laravel-steam-auth
包简介
Steam Auth for Laravel
README 文档
README
Package allows you to implement Steam authentication in your Laravel project.
Requirements
- Laravel 9+
- PHP 8.1+
Installation
Install the package
composer require duelistrage/laravel-steam-auth
Publish the config file
php artisan vendor:publish --provider="Ilzrv\LaravelSteamAuth\ServiceProvider"
Setup Steam API Key(s)
Add your Steam API key to your .env file. You can find it here.
if you want to use multiple API keys just list them separated by commas
STEAM_AUTH_API_KEYS=YourSteamApiKey1,YourSteamApiKey2
Tips
Client Settings
You can use any settings that your client supports, for example, a Guzzle Proxy:
<?php declare(strict_types=1); use GuzzleHttp\Client; use GuzzleHttp\Psr7\HttpFactory; use Illuminate\Http\Request; use DuelistRage\LaravelSteamAuth\SteamAuthenticator; public function __invoke( Request $request, HttpFactory $httpFactory, ): RedirectResponse { $client = new Client([ 'proxy' => 'socks5://user:password@192.168.1.1:1080', ]); $steamAuthenticator = new SteamAuthenticator( new Uri($request->getUri()), $client, $httpFactory, ); // Continuation of your code... }
Proxy Domain
If you want to make a proxy domain. Update redirect_url inside steam-auth.php to your absolute address like https://auth.test/login. You can use different domains for the local environment and for production like this:
<?php declare(strict_types=1); return [ 'redirect_url' => env('APP_ENV', 'production') == 'production' ? 'https://auth.test/login' : null, ];
In the NGINX settings for proxy domain, you can specify the following:
server {
listen 443 ssl http2;
server_name auth.test;
return 301 https://general.test$uri$is_args$args;
}
Basic example
In routes/web.php:
Route::get('login', \App\Http\Controllers\Auth\SteamAuthController::class);
Create a controller SteamAuthController.php:
<?php declare(strict_types=1); namespace App\Http\Controllers\Auth; use App\Models\User; use GuzzleHttp\Client; use GuzzleHttp\Psr7\HttpFactory; use GuzzleHttp\Psr7\Uri; use Illuminate\Auth\AuthManager; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Routing\Redirector; use DuelistRage\LaravelSteamAuth\Exceptions\Authentication\SteamResponseNotValidAuthenticationException; use DuelistRage\LaravelSteamAuth\Exceptions\Validation\ValidationException; use DuelistRage\LaravelSteamAuth\SteamAuthenticator; use DuelistRage\LaravelSteamAuth\SteamUserDto; final class SteamAuthController { public function __invoke( Request $request, Redirector $redirector, Client $client, HttpFactory $httpFactory, AuthManager $authManager, ): RedirectResponse { $steamAuthenticator = new SteamAuthenticator( new Uri($request->getUri()), $client, $httpFactory, ); try { $steamAuthenticator->auth(); } catch (ValidationException|SteamResponseNotValidAuthenticationException) { return $redirector->to( $steamAuthenticator->buildAuthUrl() ); } $steamUser = $steamAuthenticator->getSteamUser(); $authManager->login( $this->firstOrCreate($steamUser), true ); return $redirector->to('/'); } private function firstOrCreate(SteamUserDto $steamUser): User { return User::firstOrCreate([ 'steam_id' => $steamUser->getSteamId(), ], [ 'name' => $steamUser->getPersonaName(), 'avatar' => $steamUser->getAvatarFull(), 'player_level' => $steamUser->getPlayerLevel(), // ...and other what you need ]); } }
duelistrage/laravel-steam-auth 适用场景与选型建议
duelistrage/laravel-steam-auth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 08 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 duelistrage/laravel-steam-auth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 duelistrage/laravel-steam-auth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 20
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-08-04