PHP code example of miragesoft / yii2-user

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

    

miragesoft / yii2-user example snippets


    'modules' => [
        ...
        'user' => [
            'class' => 'mirage\user\UserModule',
            'userUploadDir' => '@webroot/uploads/user', //base user upload directory
            'admins' => ['admin', 'mirage'], //Username for CRUD user 
        ],
        ...
    ],

Yii::$app->user->isGuest ?
    ['label' => 'Sign in', 'url' => ['/user/auth/login']] :
    ['label' => 'Sign out (' . Yii::$app->user->identity->username . ')',
        'url' => ['/user/auth/logout'],
        'linkOptions' => ['data-method' => 'post']],
['label' => 'Register', 'url' => ['/user/regist/signup'], 'visible' => Yii::$app->user->isGuest]

$userObj = new $this->userModuleClass(['moduleId' => 'user']);
$userApi = (object)['data'=>$userObj->userData(), 'info'=>$userObj->userInfo()];
print_r($userApi);
echo '<hr />';
echo 'Fullname: '.$userApi->info->fullname;