vadim-skorba / scn-social-auth
使用 HybridAuth PHP 库为 ZfcUser ZF2 模块启用通过 Google、Facebook、Twitter、Yahoo! 等进行身份验证。
Requires
- php: >=5.3.3
- hybridauth/hybridauth: 2.2.*
- zendframework/zendframework: 2.*
- zf-commons/zfc-base: 0.1.*
- zf-commons/zfc-user: 1.2.*
Requires (Dev)
- mockery/mockery: 0.8.0
- dev-master
- 1.15.0
- 1.15.0-rc.2
- 1.15.0-rc.1
- 1.14.1
- 1.14.0
- 1.13.0
- 1.12.1
- 1.12.0
- 1.11.3
- 1.11.2
- 1.11.1
- 1.11.0
- 1.10.0
- 1.9.4
- 1.9.3
- 1.9.2
- 1.9.1
- 1.9.0
- 1.8.4
- 1.8.3
- 1.8.2
- 1.8.1
- 1.8.0
- 1.7.7
- 1.7.6
- 1.7.5
- 1.7.4
- 1.7.3
- 1.7.2
- 1.7.1
- 1.7.0
- 1.6.4
- 1.6.3
- 1.6.2
- 1.6.1
- 1.6.0
- 1.5.1
- 1.5.0
- 1.4.0
- 1.3.2
- 1.3.1
- 1.3.0
- 1.2.0
- 1.1.3
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- dev-hotfix/132
- dev-hotfix/dedicated-auth-adapter-chain
- dev-hotfix/zfc-user
- dev-hotfix/hybridauth
- dev-hotfix-provider-plugin
This package is not auto-updated.
Last update: 2024-09-24 16:01:06 UTC
README
使用 HybridAuth PHP 库为 ZfcUser ZF2 模块启用通过 Google、Facebook、Twitter、Yahoo! 等进行身份验证。
需求
- Zend Framework 2 (2.*)
- ZfcBase (0.1.*)
- ZfcUser (1.2.*)
- HybridAuth (2.2.*)
- 在 php.ini 中启用扩展 php_curl
特性
- 通过 AOL 登录 [不再支持]
- 通过 Facebook 登录 [完全支持]
- 通过 Foursquare 登录 [完全支持]
- 通过 Github 登录 [完全支持]
- 通过 Google 登录 [完全支持]
- 通过 LinkedIn 登录 [完全支持]
- 通过 Live 登录 [不完全支持]
- 通过 MySpace 登录 [不完全支持]
- 通过 OpenID 登录 [不完全支持]
- 通过 Twitter 登录 [完全支持]
- 通过 Yahoo! 登录 [完全支持]
- 通过 Tumblr 登录 [完全支持]
- 通过 Mail.Ru 登录 [完全支持]
- 通过 Odnoklassniki 登录 [完全支持]
- 通过 VKontakte 登录 [完全支持]
- 通过 Yandex 登录 [完全支持]
- 通过 Instagram 登录 [完全支持]
安装
建议使用 Composer 将此模块添加到您的 Zend Framework 2 应用程序中。在克隆 ZendSkeletonApplication 后,将 "socalnick/scn-social-auth" 添加到需求列表中,然后运行 php composer.phar install/update。您的 composer.json 应该看起来像这样
{
"name": "zendframework/skeleton-application",
"description": "Skeleton Application for ZF2",
"license": "BSD-3-Clause",
"keywords": [
"framework",
"zf2"
],
"homepage": "http://framework.zend.com/",
"require": {
"php": ">=5.3.3",
"zendframework/zendframework": "2.*",
"socalnick/scn-social-auth": "1.*"
}
}
接下来,将所需模块添加到 config/application.config.php
<?php
return array(
'modules' => array(
'Application',
'ScnSocialAuth',
'ZfcBase',
'ZfcUser',
),
'module_listener_options' => array(
'config_glob_paths' => array(
'config/autoload/{,*.}{global,local}.php',
),
'module_paths' => array(
'./module',
'./vendor',
),
),
);
导入 ZfcUser (./vendor/zf-commons/zfc-user/data/schema.sql
) 和 ScnSocialAuth (./vendor/socalnick/scn-social-auth/data/schema.sql
) 的模式。
如果您的服务管理器配置中尚未有有效的 Zend\Db\Adapter\Adapter,请在 ./config/autoload/database.local.php
中放置以下内容
<?php
$dbParams = array(
'database' => 'changeme',
'username' => 'changeme',
'password' => 'changeme',
'hostname' => 'changeme',
);
return array(
'service_manager' => array(
'factories' => array(
'Zend\Db\Adapter\Adapter' => function ($sm) use ($dbParams) {
return new Zend\Db\Adapter\Adapter(array(
'driver' => 'pdo',
'dsn' => 'mysql:dbname='.$dbParams['database'].';host='.$dbParams['hostname'],
'database' => $dbParams['database'],
'username' => $dbParams['username'],
'password' => $dbParams['password'],
'hostname' => $dbParams['hostname'],
));
},
),
),
);
如果您的服务管理器配置中尚未有有效的 Zend\Session\SessionManager,请在 ./config/autoload/session.local.php
中放置以下内容
<?php
return array(
'service_manager' => array(
'invokables' => array(
'Zend\Session\SessionManager' => 'Zend\Session\SessionManager',
),
),
);
选项
请确保检查 ZfcUser 中的可用选项: https://github.com/ZF-Commons/ZfcUser#options
ScnSocialAuth 模块有两个文件,允许您配置支持的提供者。安装 ScnSocialAuth 后,将 ./vendor/socalnick/scn-social-auth/config/scn-social-auth.global.php.dist
复制到 ./config/autoload/scn-social-auth.global.php
并根据需要更改值。也将 ./vendor/socalnick/scn-social-auth/config/scn-social-auth.local.php.dist
复制到 ./config/autoload/scn-social-auth.local.php
并根据需要更改值。