1. Go to this page and download the library: Download su-pn-psu/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/ */
su-pn-psu / yii2-user example snippets
'modules' => [
...
'user' => [ //module id = 'user' only
'class' => 'anda\user\Module',
'loginBy' => 'db', //db or ldap (ldap not work)
'userUploadDir' => '@uploads', //Base uploads Directory
'userUploadUrl' => '/uploads', //Url of userUploadDir
'userUploadPath' => 'user', //path after upload directory
'admins' => ['admin', 'root'] //list of username for manage users
],
...
],
'components' => [
...
'user' => [
'identityClass' => 'anda\user\models\User',
],
...
],
//Current user
$user = Yii::$app->user->identity;
print_r($user->profile->resultInfo);
//if use $user->profile->resultData in result = base user data
//another user
$user = \anda\user\models\User::findOne(2);
print_r($user->profile->resultInfo);
//if use $user->profile->resultData in result = base user data
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.