FastComments.com

FastComments PHP SSO SDK

這是 FastComments 官方的 PHP SSO SDK。

用於 FastComments SSO 整合的 PHP SDK

程式碼庫

在 GitHub 上查看

AI 程式編寫代理 Internal Link

skills.sh

為您的程式編寫代理提供 FastComments 所需的上下文——小工具、設定、Secure SSO、REST API 與 SDK:

npx skills add fastcomments/skills

支援 Claude Code、Codex、Cursor、Copilot、Gemini,以及所有其他由 skills CLI 支援的代理。

安裝 Internal Link

composer require fastcomments/sso

使用方式 Internal Link

簡易 SSO

簡易 SSO 使用起來很簡單,但安全性低於安全 SSO:

use FastComments\SSO\FastCommentsSSO;
use FastComments\SSO\SimpleSSOUserData;

// 建立使用者資料
$userData = SimpleSSOUserData::create(
    'username123',
    'user@example.com',
    'https://example.com/avatar.png'
);

// 使用基於 URL 的登入/登出
$sso = FastCommentsSSO::createWithUrls(
    null,
    $userData,
    'https://example.com/login',
    'https://example.com/logout'
);

// 或使用回呼函式
$sso = FastCommentsSSO::createWithCallbacks(
    $userData,
    function($url) { /* 處理登入 */ },
    function($url) { /* 處理登出 */ }
);

// 取得要傳遞給 FastComments 的權杖
$token = $sso->prepareToSend();

安全 SSO

安全 SSO 透過 HMAC 驗證提供增強的安全性:

use FastComments\SSO\FastCommentsSSO;
use FastComments\SSO\SecureSSOUserData;

// 建立使用者資料
$userData = SecureSSOUserData::create(
    'user-123',
    'user@example.com',
    'username123',
    'https://example.com/avatar.png'
);

// 視需要新增選填資料
$userData->isAdmin = true;
$userData->groupIds = ['group-1', 'group-2'];

// 使用您的 API 金鑰建立 SSO 物件
$sso = FastCommentsSSO::createSecure('your-api-key', $userData);

// 取得要傳遞給 FastComments 的權杖
$token = $sso->prepareToSend();

文件 Internal Link

有關 FastComments SSO 的完整文件,請參閱 FastComments 文件.

需要幫助?

如果您在使用 PHP SSO SDK 時遇到任何問題或有任何疑問,請:

貢獻

歡迎各種貢獻!請造訪 GitHub 儲存庫 以查看貢獻指南。