snipedragon/steamlink

通过Steam的OpenID提供身份验证,并返回认证用户的对象。

1.0.2 2018-05-19 07:15 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:21:11 UTC


README

GitHub release PHP from Packagist GitHub license Packagist GitHub issues

通过Steam的OpenID提供身份验证,并返回认证用户的对象。

我没有找到满足我需求的方法,所以我制作了自己的,我为自己设定的目标如下

  1. 使用Steam提供的登录按钮图形生成登录按钮/URL。
  2. 开始一个会话(可选),并在登录时返回用户对象。
  3. 能够通过提供steamid刷新用户对象。

入门 - Composer

将此添加到您的 composer.json 文件中的require对象

"snipedragon/steamlink": "1.*"

然后,运行 composer install 安装包。

或者

composer require snipedragon/steamlink:1.*

示例

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

$options = array(
    'apiKey' => 'YOUR-API-KEY-HERE', // Steam API KEY
    'domainName' => 'https://your-site.net', // Shown on the Steam Login page to your users.
    'loginRedirect' => 'https://your-site.net/index.php?page=SteamLink&action=Login', // Returns user to this page on login.
    'logoutRedirect' => 'https://your-site.net/index.php?page=SteamLink&action=Logout', // Returns user to this page on logout.
    'startSession' => false //true to start session, false to only validate and return a steam user object.
);

$steamlink = new SnipeDragon\SteamLink($options);

echo "<p>Click on the following button to login and authenticate yourself through Steam:</p>";
echo $steamlink->loginButton("rectangle"); //Can be "rectangle" or "square".