Invalid configuration - yii \ base \ InvalidConfigException - Yii2

I just installed the Yii2-User module / Dektrium in my main Yii2-app with this command

composer require "dektrium/yii2-user:0.9.*@dev"

config /console.php

return [
    .
    .
    'modules' => [
        'gii' => 'yii\gii\Module',
        'user' => [
            'class' => 'dektrium\user\Module',
            ],
        ],
    .
    .
]

config /web.php

'components' => [
    .
    .
    /*
        'user' => [
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true,
        ],
    */
    'modules' => [
        'user' => [
            'class' => 'dektrium\user\Module',
            ],
    ],
    .
    .
]

After that, I ran this command $ php yii migrate/up --migrationPath=@vendor/dektrium/yii2-user/migrationsto update the database schema.

But, when I launch http://localhost/mylawsuit/yii/web/index.php?r=user/registration/registerin my browser. This causes an error:

Incorrect configuration - yii \ base \ InvalidConfigException

The configuration of the "modules" component should contain a "class" element.

Error screenshot

enter image description here

And when I change web.php

'user' => [
            'identityClass' => 'app\models\User',
            'enableAutoLogin' => true,
        ],
    /*
    'modules' => [
        'user' => [
            'class' => 'dektrium\user\Module',
            ],
    ],

Entering http://localhost/mylawsuit/yii/web/index.php?r=user/registration/registerinto my browser, it shows

Not Found (# 404)

Page not found.

Screenshot

enter image description here

I do not understand where I am mistaken. Please help me fix it.

+4
2

.

'modules'=>[...] 'components'=>[...], .

config/web.php

$config = [
  'id' => 'basic',
  'basePath' => dirname(__DIR__),
  'bootstrap' => ['log'],
  'components' => [
   .
   .
   .
   ],
  'modules' => [
    'user' => [
      'class' => 'dektrium\user\Module',
    ],
  ],
  'params' => $params,

.

+1

u ['/user/security/login'] "/user/login" 404, - "urlManager". enblePrettyUrl, . - .

0

Source: https://habr.com/ru/post/1611271/


All Articles