PHPackages                             su-pn-psu/yii2-user - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. su-pn-psu/yii2-user

ActiveYii2-extension[Authentication &amp; Authorization](/categories/authentication)

su-pn-psu/yii2-user
===================

Yii 2 for User

1.0(9y ago)071[2 issues](https://github.com/su-pn-psu/yii2-user/issues)GPL-3.0PHPPHP &gt;=5.4.0

Since Sep 5Pushed 9y ago1 watchersCompare

[ Source](https://github.com/su-pn-psu/yii2-user)[ Packagist](https://packagist.org/packages/su-pn-psu/yii2-user)[ RSS](/packages/su-pn-psu-yii2-user/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (6)Versions (2)Used By (0)

yii2-user
=========

[](#yii2-user)

Installation
------------

[](#installation)

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

Either run

```
composer require su-pn-psu/yii2-user "dev-master"

```

or add

```
"su-pn-psu/yii2-user": "dev-master"

```

to the require section of your `composer.json` file.

Usage
-----

[](#usage)

Once the extension is installed, simply use it in your code by :

Config

```
    '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',
        ],
        ...
    ],
```

Migration table user and profile

```
./yii migrate --migrationPath=@anda/user/migrations/
```

List of available actions
=========================

[](#list-of-available-actions)

- **/user/regist/signup** Displays registration form
- **/user/auth/login** Displays login form
- **/user/auth/logout** Logs the user out (available only via POST method)
- **/user/auth/request-password-reset** Displays request password reset form
- **/user/auth/reset-password** Displays reset password form
- **/user/settings/profile** Displays profile settings form
- **/user/settings/account** Displays account settings form
- **/user/settings/change-password** Displays change password settings form
- **/user/admin/index** Displays user management interface

Example of menu
---------------

[](#example-of-menu)

You can add links to registration, login and logout as follows:

```
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]
```

Call user information
---------------------

[](#call-user-information)

```
//Current user
$user = Yii::$app->user->identity;
print_r($user->profile->resultInfo);
//if use $user->profile->resultData in result = base user data
```

Example Result

```
stdClass Object
(
    [id] => 1
    [username] => admin
    [email] => admin@su-pn-psu.net
    [created_at] => 1473135990
    [updated_at] => 1473135990
    [firstname] => Admin
    [lastname] => สูงสุด
    [fullname] => Admin สูงสุด
    [avatar] => /uploads/user/avatars/57ce45f61e617_57ce45f60fb8b.jpg
    [cover] => /assets/37f5d0d0/images/default-cover.jpg
    [bio] =>
    [data] => Not set
    [roles] => Array
        (
        )

)
```

```
//another user
$user = \anda\user\models\User::findOne(2);
print_r($user->profile->resultInfo);
//if use $user->profile->resultData in result = base user data
```

Example Result

```
stdClass Object
(
    [id] => 2
    [username] => surakit.c
    [email] => surakit.c@psu.ac.th
    [created_at] => 1473136616
    [updated_at] => 1473136616
    [firstname] => สุรกิจ
    [lastname] => ชูเดช
    [fullname] => สุรกิจ ชูเดช
    [avatar] => /uploads/user/avatars/57ce4a3126b31_57ce4a31218d0.jpg
    [cover] => /uploads/user/covers/57ce4a5bd842f_57ce4a5bd40bd.png
    [bio] =>
    [data] => Not set
    [roles] => Array
        (
        )

)
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

3537d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0d6e22c84850458304b5e06e01829622a1a97459c9ee7aaf738dd07bd5c559ab?d=identicon)[madone](/maintainers/madone)

---

Top Contributors

[![firdows](https://avatars.githubusercontent.com/u/18734077?v=4)](https://github.com/firdows "firdows (24 commits)")

---

Tags

yii2extension

### Embed Badge

![Health badge](/badges/su-pn-psu-yii2-user/health.svg)

```
[![Health](https://phpackages.com/badges/su-pn-psu-yii2-user/health.svg)](https://phpackages.com/packages/su-pn-psu-yii2-user)
```

###  Alternatives

[lowbase/yii2-user

Yii2 user module

131.5k2](/packages/lowbase-yii2-user)[kakadu-dev/yii2-jwt-auth

Extension provide JWT auth for Yii2

105.8k](/packages/kakadu-dev-yii2-jwt-auth)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
