PHP code example of zakharov-andrew / yii2-user

1. Go to this page and download the library: Download zakharov-andrew/yii2-user library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zakharov-andrew / yii2-user example snippets


return [
    // ...
    'controllerMap' => [
        // ...
        'migrate' => [
            'class' => 'yii\console\controllers\MigrateController',
            'migrationPath' => [
                '@console/migrations', // Default migration folder
                '@vendor/zakharov-andrew/yii2-user/src/migrations'
            ]
        ]
        // ...
    ]
    // ...
];

    'modules' => [
        'user' => [
            'class' => 'ZakharovAndrew\user\Module',
            'bootstrapVersion' => 5, // if use bootstrap 5
            'showTitle' => true, // display H1 headings (default - true)
            'telegramToken' => '', // necessary for the bot to work
            'telegramBotLink' => 'https://t.me/YOUR_BOT_NAME_FOR_USER_LINK', //change!
            // use for menu and access
            'controllersAccessList' => [
                1001 => [
                            'Users' => [
                                '/user/user/index' => 'users',
                                '/user/user/create' => 'create user',
                            ],
                        ], 
                1002 => ['/user/roles/index' => 'Roles']
            ]
        ],
        // ...
    ],

return [
    // ...
    'supportEmail' => '[email protected]',
    // lifetime of the password reset token
    'userResetPasswordTokenExpire' => 3600
    // ...
];

'urlManager' => [
    //...
    'rules' => [
        'login' => 'user/user/login',
        'logout' => 'user/user/logout',
        'profile' => 'user/user/profile',
        //...
    ],
    //...
],

<?= \ZakharovAndrew\user\components\BirthdayWidget::widget([
    'headerMessage' => 'Today’s birthdays:',
    'noBirthdaysMessage' => 'Today, no one is celebrating a birthday.', // or empty
    'useAvatars' => true
]); 

<?= \ZakharovAndrew\user\components\BirthdayGreetingWidget::widget([
    'message' => '<h1>Happy Birthday, {username}!</h1>'
]) 
config\params.php