Download the PHP package anerg2046/sns_auth without Composer

On this page you can find all versions of the php package anerg2046/sns_auth. 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 sns_auth

通用第三方登录说明文档

GitHub stars GitHub forks GitHub issues Scrutinizer Code Quality Build Status Latest Stable Version Total Downloads License PHP Version

2.0 版本全新发布,目前支持的登录平台包括:

安装

类库使用的命名空间为\\anerg\\OAuth2

目录结构

公共方法

在接口文件中,定义了 4 个方法,是每个第三方基类都必须实现的,用于相关的第三方登录操作和获取数据。方法名如下:

微信有一个额外的方法,用于获取代理请求的地址

典型用法

以 ThinkPHP5 为例

2.0 版本不再通过系统自动设置 state,如有需要请自行处理验证,state 也放入 config 里即可

Line 和 Facebook 强制要求传递 state,如果你没有设置,则会传递随机值

如果要验证 state,则在获取用户信息的时候要加上->mustCheckState()方法。

注意,不是所有的平台都支持传递 state,请自行阅读官方文档

客户端登录

配置文件样例

1.微信

2.QQ

QQ 现在可以获取unionid了,详见: http://wiki.connect.qq.com/unionid%E4%BB%8B%E7%BB%8D 只需要配置参数$config['withUnionid'] = true,默认不会请求获取 Unionid

3.微博

4.支付宝

5.Facebook

facebook 有个特殊的配置$config['field'],默认是'id,name,gender,picture.width(400)',你可以根据需求参考官方文档自行选择要获取的用户信息

6.Twitter

7.Line

8.Google

返回样例

微信会返回特有的 unionid 字段

其他

使用中如果有什么问题,请提交 issue,我会及时查看


All versions of sns_auth with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6.0
guzzlehttp/guzzle Version ^7
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 anerg2046/sns_auth contains the following files

Loading the files please wait ....