Download the PHP package wycto/login without Composer

On this page you can find all versions of the php package wycto/login. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package login

PHP第三方登录类库

安装

composer require wycto/login

类库列表,持续更新

QQ登录

微信登录

微博登录

使用方法

//登录方法
$name = 'qq',$config = array()
$login = \login\Login::getApp($name,$config);
$login->login();

//登录回调
$name = 'qq',$config = array()
$login = \login\Login::getApp($name,$config);
$login->getUserInfo();

配置强调

$config['framework'] = 'tp';//framework为空使用原生$_SESSION, tp使用thinkphp的session助手函数

QQ登录示例:

$name = 'qq';
$config = array(
    //开发平台获取
    'app_id' => '101389004',
    //开发平台获取
    'app_key' => '5023acb17c76531a664e995b89e5de07',
    //回掉地址,需要在腾讯开发平台填写
    'callback' => "/index/user/qqcallback",
    'scope' => 'get_user_info',
    'expires_in' => 7775000
);

/**
 * QQ登录
 */
function qqLoginAction()
{
    // qq登录
    $this->_set_referer();
    $login = \login\Login::getApp($name,$config);
    $login->login();
}

/**
 * QQ登录回调
 */
function qqCallbackAction()
{
    $login = \login\Login::getApp($name,$config);
    // 获取用户信息
    $userinfo = $login->getUserInfo();

    if (! isset($userinfo['openid']) || empty($userinfo['openid'])) {
        return $this->redirect(url("index/index/index"));
    }
    // 查询是否存在
    $user = User::get(array(
        'qq_openid' => $userinfo['openid']
    ));
    if ($user) {
        // 账号存在去登录
        return $this->_toLogin($user, false);
    } else {
        // 新注册该用户
        Session::set("qq_userinfo", $userinfo);
        return $this->redirect(url("index/user/newAccount"));
    }
}

微信登录示例:

$name = 'weixin';
$config = array(
    //开发平台获取
    'app_id' => 'wx587351c59b2fbca4',
    //开发平台获取
    'app_secret' => '382b75b03fa71c5691555c65037598dc',
    //回掉地址,需要在腾讯开发平台填写
    'callback' => "/default/user/wxcallback",
    //终端类型
    'terminal' => "pc",//pc为电脑端扫码登录,否则微信公众号登录
    //手机端回调地址
    'callback_wx' => "/wap/user/wxcallback",
    //订阅号appid
    'app_id_d' => 'wxae475941e485a3a8',
    //订阅号app_secret
    'app_secret_d' => '3ca2f30daa500012a51b0d126e83eefe'
);

//登录
$login = \login\Login::getApp($name,$config);
$login->login();

//回调获取信息
$login = \login\Login::getApp($name,$config);
$userinfo = $login->getUserInfo();

All versions of login with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package wycto/login contains the following files

Loading the files please wait ....