deyin/dyoauth

第三方登录授权SDK,用于第三方QQ,微信,微博登录

v3.3 2020-03-13 13:31 UTC

This package is auto-updated.

Last update: 2025-06-14 01:56:22 UTC


README

用于登录QQ,微信,微博

暂时只维护了QQ模块,后续需要添加新的模块

安装:

安装方式一:

composer require deyin/dyoauth

安装方式二:

在您的composer.json中加入配置:

{
    "require": {
        "deyin/dyoauth": "~2.0"
    }
}

示例: 发起请求

/**
 * 第三方登录入口
 * */
public function actionThirdParty()
{
    $type = $_GET['type'];
    if ($type == 'qq') {
        $appId = '';
        $appKey = '';
        $callbackUrl = '';
        $qq = new qqOauth($appId, $appKey, $callbackUrl);
        $url = $qq->getAuthorizeURL();
    }
    $this->redirect($url);
}

示例: 接受回调

$qq = new qqOauth();
$code = $_GET['code'];
$qq->getUserInfo($code);;