PHPackages                             sergmoro1/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. sergmoro1/yii2-user

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

sergmoro1/yii2-user
===================

User registration by email with confirmation. Users management. Login with OAuth2 credensials. Predefined for role based access control.

v1.1.4(6y ago)01321MITPHPPHP &gt;=5.4.0

Since Sep 2Pushed 6y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (5)Used By (1)

Yii2 module for user registration and management
================================================

[](#yii2-module-for-user-registration-and-management)

Advantages
----------

[](#advantages)

- registration, email confirmation, reset password, authentification;
- social networks OAuth2 authentification (avatar available);
- backend users management.

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

[](#installation)

The preferred way to install this extension is through composer.

Either run

`composer require --prefer-dist sergmoro1/yii2-user`

or add

`"sergmoro1/yii2-user": "^1.1"`

to the require section of your composer.json.

Run migration

`php yii migrate --migrationPath=@vendor/sergmoro1/yii2-user/src/migrations`

Configuration
-------------

[](#configuration)

Add to the configuration file used modules definitions, OAuth2 and mailler components.

```
return [
    ...
    'modules' => [
        'lookup' => ['class' => 'sergmoro1\lookup\Module'],
        'user'   => ['class' => 'sergmoro1\user\Module'],
    ],
    'components' => [
        'authClientCollection' => [
            'class' => 'yii\authclient\Collection',
            'clients' => [
                'yandex' => [
                    'class' => 'yii\authclient\clients\Yandex',
                    'clientId' => 'YandexClientId',
                    'clientSecret' => 'YandexClientSecret',
                ],
            ],
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => false,
            'viewPath' => '@vendor/sergmoro1/yii2-user/src/mail',
            /* Example of definition (Yandex)
            'transport' => [
                'class' => 'Swift_SmtpTransport',
                'host' => 'smtp.yandex.ru',
                'username' => 'admin@your-site.ru',
                'password' => 'your-password',
                'port' => '465',
                'encryption' => 'ssl',
            ],
            */
        ],
    ],
```

Redeclare `getAvatarImage()`, something like this (if `sergmoro1/yii2-uploader` is used) or any other way.

```
    public function getAvatarImage()
    {
        return $this->getImage('thumb');
    }
```

Usage
-----

[](#usage)

Add action for OAuth2 authentification with social network accounts to controller.

```
namespace frontend\controllers;

use Yii;
use sergmoro1\user\traits\AuthTrait;

class SiteController extends Controller
{
    use AuthTrait;

    /**
     * Handler for EVENT_AFTER_LOGGED_IN. May be defined if needed.
     */
    public function init()
    {
        parent::init();
        $this->on(\sergmoro1\user\Module::EVENT_AFTER_LOGGED_IN, function($event) { Yii::$app->session->setFlash('success',
            Yii::t('app', 'You are logged in as a commentator. You can leave a comment now.'));
        });
    }

    /**
     * inheritdoc
     */
    public function actions()
    {
        return [
            'auth' => [
                'class' => 'yii\authclient\AuthAction',
                'successCallback' => [$this, 'onAuthSuccess'],
            ],
        ];
    }
```

Place the widget somewhere in the view.

```

```

Social icons can be defined in `Yii::$app->params['icons']`. Their use is determined by `widgets/views/socialCredentials.php`.

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity56

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

Every ~63 days

Total

4

Last Release

2253d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/47754c3aa326cd8f607f8207a47193bb3286eac44fded6dd5a312da13358e76c?d=identicon)[sergmoro1](/maintainers/sergmoro1)

---

Top Contributors

[![sergmoro1](https://avatars.githubusercontent.com/u/5292104?v=4)](https://github.com/sergmoro1 "sergmoro1 (72 commits)")

---

Tags

useroauth2rolesrbacyii2registrationmanagementauthentification

### Embed Badge

![Health badge](/badges/sergmoro1-yii2-user/health.svg)

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

###  Alternatives

[2amigos/yii2-usuario

Highly customizable and extensible user management, authentication, and authorization Yii2 extension

298275.5k14](/packages/2amigos-yii2-usuario)[budyaga/yii2-users

Module for manage users and their rights with the support of registration through social services and assigned to each user more than one social service.

409.1k](/packages/budyaga-yii2-users)[vova07/yii2-rbac-module

The RBAC module for Yii framework.

191.2k2](/packages/vova07-yii2-rbac-module)[lowbase/yii2-user

Yii2 user module

131.5k2](/packages/lowbase-yii2-user)

PHPackages © 2026

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