EAuth扩展Yii2,类nodge \ eauth \ EAuth不存在

时间:2016-12-16 09:30:37

标签: php yii2 composer-php

我正在尝试在EAuth高级应用程序中使用Yii2扩展名。我通过composer安装它并将其安装在供应商目录下并按照提到的here配置(在common / config / main中配置)。因此,以下是该目录的结构:

root
   vendor
        nodege
            lightopenid
                     provider
                          *files go here*
            yii2-eauth
                     src
                       *files go here*

EAuth.php位于src文件夹下。在控制器中我使用了这个:

use nodge\eauth\EAuth;

当我这样做时:

$eauth = Yii::$app->get('eauth')->getIdentity($serviceName);

我收到以下错误:

  

类nodge \ eauth \ EAuth不存在

我做错了什么?有什么帮助吗?

更新

这是我的配置:

'components' => [
        'cache' => [
            'class' => 'yii\caching\FileCache',
        ],
        'eauth' => [
            'class' => 'nodge\eauth\EAuth',
            'popup' => true, // Use the popup window instead of redirecting.
            'cache' => false, // Cache component name or false to disable cache. Defaults to 'cache' on production environments.
            'cacheExpire' => 0, // Cache lifetime. Defaults to 0 - means unlimited.
            'httpClient' => [
// uncomment this to use streams in safe_mode
//'useStreamsFallback' => true,
            ],
            'services' => [// You can change the providers and their classes.
                'google' => [
// register your app here: https://code.google.com/apis/console/
                    'class' => 'nodge\eauth\services\GoogleOAuth2Service',
                    'clientId' => '...',
                    'clientSecret' => '...',
                    'title' => 'Google',
                ],
                'facebook' => [
// register your app here: https://developers.facebook.com/apps/
                    'class' => 'nodge\eauth\services\FacebookOAuth2Service',
                    'clientId' => '---',
                    'clientSecret' => '---',
                ],
                'yahoo' => [
                    'class' => 'nodge\eauth\services\YahooOpenIDService',
                //'realm' => '*.example.org', // your domain, can be with wildcard to authenticate on subdomains.
                ],
        ],
    ],
],

0 个答案:

没有答案