PHP code example of zpearl / yii2-users-module

1. Go to this page and download the library: Download zpearl/yii2-users-module 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/ */

    

zpearl / yii2-users-module example snippets


'modules' => [
    'users' => [
        'class' => 'zpearl\users\Module',
        ' all `users` emails.
        'robotName' => 'My Robot Name', // By default is `Yii::$app->name . ' robot'`.
        'activationWithin' => 86400, // The time before a sent activation token becomes invalid.
        'recoveryWithin' => 14400, // The time before a sent recovery token becomes invalid.
        'recordsPerPage' => 10, // Users pe page.
        'adminRoles' => ['superadmin', 'admin'], // User roles that can access backend module.
    ]
]

'user' => [
    'class' => 'yii\web\User',
    'identityClass' => 'zpearl\users\models\User',
    'loginUrl' => ['/users/guest/login']  // For frontend app
    // 'loginUrl' => ['/users/admin/login']  // For backend app
]

'authManager' => [
    'class' => 'yii\rbac\PhpManager',
    'defaultRoles' => [
        'user',
        'admin',
        'superadmin'
    ],
    'itemFile' => '@zpearl/rbac/data/items.php',
    'assignmentFile' => '@zpearl/rbac/data/assignments.php',
    'ruleFile' => '@zpearl/rbac/data/rules.php',
]

php yii migrate --migrationPath=@zpearl/users/migrations

Yii::$app->getModule('users');

php composer.phar