Good day! Tell me please. Everything seems to be done according to the manual, but I don’t understand something. I used to work with yii 1, now I may not quite understand the use of use.

Climb error Class 'yii \ authclient \ widgets \ AuthChoice' not found

composer.json

"require": { "php": ">=5.4.0", "yiisoft/yii2": ">=2.0.5", "yiisoft/yii2-bootstrap": "*", "yiisoft/yii2-swiftmailer": "*", "yiisoft/yii2-authclient": "*" }, 

config / web.php

  'authClientCollection' => [ 'class' => 'yii\authclient\Collection', 'clients' => [ 'facebook' => [ 'class' => 'yii\authclient\clients\Facebook', 'authUrl' => 'https://www.facebook.com/dialog/oauth?display=popup', 'clientId' => '***', 'clientSecret' => '***', ], ], ], 

view / index.php

  use yii\authclient\widgets\AuthChoice; <?=yii\authclient\widgets\AuthChoice::widget([ 'baseAuthUrl' => ['site/auth'], 'popupMode' => true, ]); ?> 

the file itself is available: /vendor/yiisoft/yii2-authclient/widgets/AuthChoice.php

3 answers 3

Try instead of yii\authclient\widgets\AuthChoice::widget :
either AuthChoice::widget or \yii\authclient\widgets\AuthChoice::widget . In the second case, the use command is optional.

If it does not help, you need to look at the autoloader - debug it, look at the ways the class is trying to drag on.

    I thank everyone for the advice!

    The fact of the matter was that I installed the extension in a straight line "as before", and not through Composer.

      For those who still install extensions manually (it is necessary, if there is no access to the console, etc.) - in vendor\yiisoft\extensions.php prescribe in a similar way to the rest.