vikas5914/steam-auth

一个简单的PHP Steam登录和用户详情包

v1.0.3 2021-03-24 20:52 UTC

This package is auto-updated.

Last update: 2024-09-25 05:00:39 UTC


README

Latest Stable Version Total Downloads License GitHub issues Packagist

此包允许您通过Steam的OpenID服务轻松登录用户并获取用户详情。然而,此包不需要您安装OpenID PHP模块!

通过Composer安装

将以下内容添加到您的 composer.json 文件中的 require 对象

"vikas5914/steam-auth": "1.*"

然后,运行 composer install 安装包。

或者

composer require vikas5914/steam-auth:1.*

使用示例

require __DIR__ . '/vendor/autoload.php';

$config = array(
    'apikey' => 'xxxxxxxxxxxxxxxxx', // Steam API KEY
    'domainname' => 'https://:3000', // Displayed domain in the login-screen
    'loginpage' => 'https://:3000/index.php', // Returns to last page if not set
    "logoutpage" => "",
    "skipAPI" => false, // true = dont get the data from steam, just return the steamid64
);

$steam = new Vikas5914\SteamAuth($config);

if ($steam->loggedIn()) {
    echo "Hello " . $steam->personaname . "!";
    echo "<a href='" . $steam->logout() . "'>Logout</a>";
} else {
    echo "<a href='" . $steam->loginUrl() . "'>Login</a>";
}

用户数据可以通过 $steam->varName; 访问。您可以在示例文件中找到一个基本的变量列表,或者在代码中找到一个更高级的列表。

使用 $steam->loggedIn(); 检查用户是否已登录(将返回true或false)

计划中

  1. 测试用例
  2. 更好的README

法律事项

如果您选择使用Steam Web API,则需要遵守位于 http://steamcommunity.com/dev/apiterms 的Steam Web API使用条款。

标记的代码取自Syntax_Error的"Ultra Simple Steam-Login"类,可在 http://forums.steampowered.com/forums/showthread.php?t=1430511 找到。

forthebadge