安装Yii2用户管理模块


Installing Yii2 User Management Module

我正在尝试安装用户管理模块到Yii2应用程序(供参考,这是模块:https://github.com/webvimark/user-management)。

让我们说我不知道作曲家是什么,但我安装了它,并设法使它为安装工作。我正在运行本地服务器,因为应用程序在共享主机上,我无法访问SSH终端。

我做了README文件中指定的所有更改,并运行了composer require --prefer-dist webvimark/module-user-management "*"。它发挥了它的魔力,据我所知,它在应用程序的供应商文件夹中生成了一堆目录。我把它们上传到服务器,但现在当我试图加载主页时,我得到一个错误:

类webvimark'modules'UserManagement'components'UserConfig没有存在

文件当前在这里:

APPLICATION_HOME ' public_html ' '基本组件供应商' webvimark ' module-user-management '

,但似乎应用程序无法找到它。我没有模块目录(就像我在以前的Yii版本中使用的那样),我所有的配置和其他文件都按照自述文件中指定的方式更新。知道哪里出错了吗?

编辑:以防万一,添加我的config/web.php:
<?php
$params = require(__DIR__ . '/params.php');
$config = [
    'id' => 'basic',
    'basePath' => dirname(__DIR__),
    'bootstrap' => ['log'],
    'components' => [
        'request' => [
            // !!! insert a secret key in the following (if it is empty) - this is required by cookie validation
            'cookieValidationKey' => 'SOME_RANDOM_STRING',
        ],
        'cache' => [
            'class' => 'yii'caching'FileCache',
        ],
        /*'user' => [
            'identityClass' => 'app'models'User',
            'enableAutoLogin' => true,
        ],*/
        'user' => [
            'class' => 'webvimark'modules'UserManagement'components'UserConfig',
            // Comment this if you don't want to record user logins
            'on afterLogin' => function($event) {
                'webvimark'modules'UserManagement'models'UserVisitLog::newVisitor($event->identity->id);
            }
        ],
        'errorHandler' => [
            'errorAction' => 'site/error',
        ],
        'mailer' => [
            'class' => 'yii'swiftmailer'Mailer',
            // send all mails to a file by default. You have to set
            // 'useFileTransport' to false and configure a transport
            // for the mailer to send real emails.
            'useFileTransport' => true,
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'yii'log'FileTarget',
                    'levels' => ['error', 'warning'],
                ],
            ],
        ],
        'db' => require(__DIR__ . '/db.php'),
        'i18n' => [
            'translations' => [
                'frontend*' => [
                    'class' => 'yii'i18n'PhpMessageSource',
                    'basePath' => '@common/messages',
                ],
                'backend*' => [
                    'class' => 'yii'i18n'PhpMessageSource',
                    'basePath' => '@common/messages',
                ],
            ],
        ],
    ],
    'modules'=>[
        'user-management' => [
            'class' => 'webvimark'modules'UserManagement'UserManagementModule',
            // Here you can set your handler to change layout for any controller or action
            // Tip: you can use this event in any module
            'on beforeAction'=>function(yii'base'ActionEvent $event) {
                    if ( $event->action->uniqueId == 'user-management/auth/login' )
                    {
                        $event->action->controller->layout = 'loginLayout.php';
                    };
                },
        ],
    ],            
    'params' => $params,
];
if (YII_ENV_DEV) {
    // configuration adjustments for 'dev' environment
    $config['bootstrap'][] = 'debug';
    $config['modules']['debug'] = 'yii'debug'Module';
    $config['bootstrap'][] = 'gii';
    $config['modules']['gii'] = 'yii'gii'Module';
}
return $config;

试着像使用模块而不是组件那样使用它从组件中删除并添加模块

'modules'=>[
    'user-management' => [
        'class' => 'webvimark'modules'UserManagement'UserManagementModule',