allyans3/protobuf-steam-auth
Composer 安装命令:
composer require allyans3/protobuf-steam-auth
包简介
description
README 文档
README
To use this package you need to install php extension
protobuf. Installation instructions are below.
About Protobuf Steam Auth
This package provides the ability to authorize to the Steam using Google Protobuf. Support PHP 7+ and PHP 8+.
Installation
- Run this text in a console to install this package from Packagist:
composer require allyans3/protobuf-steam-auth
- Copy folder
protobuf-extfrom/vendor/allyans3/protobuf-steam-authto your project:
cp -a /vendor/allyans3/protobuf-steam-auth/protobuf-ext .
- Build php extension with next commands choosing between
php 7andphp 8(Thanks to Tankonyako):
cd protobuf-ext/php7 // For PHP 7
cd protobuf-ext/php8 // For PHP 8
For Linux/Mac:
phpize
./configure
make
make install
For Windows see this Youtube video:
- Add line
extension=protobuf.soto your php.ini file
Usage
use SteamAuth\SteamAuth; require "vendor/autoload.php"; $auth = new SteamAuth('login', 'password', 'shared_secret'); // For proxy $auth->setProxy($proxy); // For WebBrowser $auth->login(); // or for MobileApp $auth->loginMobile(); // You can check if you are authorized $auth->isAuthorized(); // If auth `true` you can get cookies $auth->getCookies(); // or by host $auth->getCookiesByHost(); // Getting data for platform type $auth->getDataForPlatformType(1) // 1 => Steam Client, 2 => Web Browser, 3 => Mobile App // Updating `access_token` with `refresh_token` $auth->updateAccessToken($refreshToken) // Decoding JWT $auth->decodeJWT($token)
Cookie storage
By default, cookie saves in $cookieStorage attribute and can be retrieved by getCookies() or getCookiesByHost() methods.
Optional, you can specify the path to your cookie file in cookie_file key.
Also, you can send your cookies as array to cookie_storage key.
use SteamAuth\SteamAuth; require "vendor/autoload.php"; $cookieOptions = [ 'cookie_file' => 'path_to_cookie_file', 'cookie_storage' => [ "steamcommunity.com" => [ "sessionid" => "*******", "steamCountry" => "*******", "steamLoginSecure" => "*******" ], "store.steampowered.com" => [ "sessionid" => "*******", "steamLoginSecure" => "*******" ], "help.steampowered.com" => [ "sessionid" => "*******", "steamLoginSecure" => "*******" ], "steam.tv" => [ "sessionid" => "*******", "steamCountry" => "*******", "steamLoginSecure" => "*******" ], "checkout.steampowered.com" => [ "steamLoginSecure" => "*******" ] ] ]; $auth = new SteamAuth('login', 'password', 'shared_secret', $cookieOptions);
Handle Exceptions
use SteamAuth\SteamAuth; require "vendor/autoload.php"; $auth = new SteamAuth('login', 'password', 'shared_secret'); try { $auth->login(); } catch (\SteamAuth\Exceptions\SteamErrorException $e) { $e->getMessage(); } catch (\SteamAuth\Exceptions\SteamResponseException $e) { $e->getMessage(); }
Proxy
v1.0.9 or later is required to use proxy.
Keys that can be in an array:
ip+portordomain_name–domain_nameused for rotating proxyuser+pass– if proxy support authtype– you can pass constant variable or integer as explained in table belowtimeout– in seconds, default infiniteconnect_timeout– in seconds, default infiniteuser_agent– your Useragent
| cURL Proxy Type | Integer |
|---|---|
| CURLPROXY_HTTP | 0 |
| CURLPROXY_HTTP_1_0 | 1 |
| CURLPROXY_HTTPS | 2 |
| CURLPROXY_SOCKS4 | 4 |
| CURLPROXY_SOCKS4A | 6 |
| CURLPROXY_SOCKS5 | 5 |
| CURLPROXY_SOCKS5_HOSTNAME | 7 |
Example:
use SteamAuth\SteamAuth; require "vendor/autoload.php"; $proxy = [ 'ip' => '49.12.181.264', 'port' => 8000, 'user' => 'user', 'pass' => 'pass' ]; $auth = new SteamAuth('login', 'password', 'shared_secret'); $auth->setProxy($proxy); $auth->login();
Support
Report bugs on the issue tracker.
License
Protobuf Steam Auth is open-sourced Composer package licensed under the MIT license.
allyans3/protobuf-steam-auth 适用场景与选型建议
allyans3/protobuf-steam-auth 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10.39k 次下载、GitHub Stars 达 21, 最近一次更新时间为 2022 年 12 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 allyans3/protobuf-steam-auth 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 allyans3/protobuf-steam-auth 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 10.39k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 21
- 点击次数: 19
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: proprietary
- 更新时间: 2022-12-04
