PHPackages                             elzix/yii2-auth - 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. elzix/yii2-auth

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

elzix/yii2-auth
===============

Yii 2 User Authentication &amp; Role Based Access Control (RBAC) Module

011PHP

Since Apr 18Pushed 1y agoCompare

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

READMEChangelogDependenciesVersions (2)Used By (0)

Auth Module
===========

[](#auth-module)

Auth Module is a flexible user registration, authentication &amp; RBAC module for Yii2. It provides user authentication, registration and RBAC support to your Yii2 site.

Tribute
=======

[](#tribute)

This project is forked from robregonm/yii2-auth. The basic functionality is the same, but some modifications have been made to make it compatible with Yii2 v2.0.49.3.

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

[](#installation)

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

Either run

```
$ php composer.phar require elzix/yii2-auth:dev-master

```

or add

```
"elzix/yii2-auth": "dev-master"

```

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

Usage
-----

[](#usage)

Once the extension is installed, modify your application configuration to include:

```
return [
  'modules' => [
    ...
    'auth' => [
      'class' => 'auth\Module',
      // Custom layouts
      // Alternative: @common/views/layouts/main
      'layout' => '//homepage', // Layout when not logged in yet
      'layoutLogged' => '//main', // Layout for logged in users
      // Custom views (optional)
      // 'loginTemplate' => '',
      // 'signupTemplate' => '',
      // 'requestTemplate' => '',
      // 'resetTemplate' => '',
      // 'profileTemplate' => '',
      // 'profileUpdateTemplate' => '',
      // 'userTemplate' => '',
      // 'userViewTemplate' => '',
      // 'userCreateTemplate' => '',
      // 'userUpdateTemplate' => '',
      'attemptsBeforeCaptcha' => 3, // Optional
      'supportEmail' => 'support@mydomain.com', // Email for notifications
      'passwordResetTokenExpire' => 3600, // Seconds for token expiration
      'superAdmins' => ['admin'], // SuperAdmin users
      'signupWithEmailOnly' => false, // false = signup with username + email, true = only email signup
      'db' => 'db', // Optional, database to use
      'tableMap' => [ // Optional, but if defined, all must be declared
        'User' => 'user',
        'UserStatus' => 'user_status',
        'ProfileFieldValue' => 'profile_field_value',
        'ProfileField' => 'profile_field',
        'ProfileFieldType' => 'profile_field_type',
      ],
      /**
       * Custom redirects (optional)
       *
       * true = Go Home
       * false = Go Back
       * string = Redirect to link
       */
      // 'loginRedirect' => '', // After login
      // 'passwordRedirect' => '', // After password reset or request
      // 'signupRedirect' => '', // After signup
    ],
    ...
  ],
  ...
  'components' => [
    ...
    'authManager' => [
      'class' => '\yii\rbac\DbManager',
      'ruleTable' => 'AuthRule', // Optional
      'itemTable' => 'AuthItem',  // Optional
      'itemChildTable' => 'AuthItemChild',  // Optional
      'assignmentTable' => 'AuthAssignment',  // Optional
    ],
    'user' => [
      'class' => 'auth\components\User',
      'identityClass' => 'auth\models\User', // or replace to your custom identityClass
      'enableAutoLogin' => true,
    ],
    ...
  ]
];
```

And run migrations:

```
$ php yii migrate/up --migrationPath=@auth/migrations
```

License
-------

[](#license)

Auth module is released under the BSD-3 License. See the bundled `LICENSE.md` for details.

\#INSTALLATION

./yii migrate/up --migrationPath=@auth/migrations

URLs
----

[](#urls)

- Login: `yourhost/auth/default/login`
- Logout: `yourhost/auth/default/logout`
- Sign-up: `yourhost/auth/default/signup`
- Reset Password: `yourhost/auth/default/reset-password`
- User management: `yourhost/auth/user/index`
- User profile: `yourhost/auth/profile/view`

[![Flattr this git repo](https://camo.githubusercontent.com/7e3f46a36526479d701ef7f90a0f8c3ac2fbab3087446e2a9fceed75cd1ab802/687474703a2f2f6170692e666c617474722e636f6d2f627574746f6e2f666c617474722d62616467652d6c617267652e706e67)](https://flattr.com/submit/auto?user_id=robregonm&url=https://github.com/robregonm/yii2-auth&title=Yii2-PDF&language=&tags=github&category=software)

###  Health Score

16

—

LowBetter than 5% of packages

Maintenance26

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity21

Early-stage or recently created project

 Bus Factor1

Top contributor holds 77.4% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/94c210889b0ef4248e24c3bf090cbe7675fda5cc90b90c4709b5fef7cbb6b09b?d=identicon)[elzix](/maintainers/elzix)

---

Top Contributors

[![robregonm](https://avatars.githubusercontent.com/u/1051457?v=4)](https://github.com/robregonm "robregonm (82 commits)")[![elzix](https://avatars.githubusercontent.com/u/7250469?v=4)](https://github.com/elzix "elzix (11 commits)")[![fwerner13](https://avatars.githubusercontent.com/u/224561?v=4)](https://github.com/fwerner13 "fwerner13 (8 commits)")[![mikebelozorov](https://avatars.githubusercontent.com/u/8688035?v=4)](https://github.com/mikebelozorov "mikebelozorov (1 commits)")[![cansozeri](https://avatars.githubusercontent.com/u/7555974?v=4)](https://github.com/cansozeri "cansozeri (1 commits)")[![youanden](https://avatars.githubusercontent.com/u/183880?v=4)](https://github.com/youanden "youanden (1 commits)")[![djfly](https://avatars.githubusercontent.com/u/4409731?v=4)](https://github.com/djfly "djfly (1 commits)")[![matyunya](https://avatars.githubusercontent.com/u/2044570?v=4)](https://github.com/matyunya "matyunya (1 commits)")

### Embed Badge

![Health badge](/badges/elzix-yii2-auth/health.svg)

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

###  Alternatives

[namshi/jose

JSON Object Signing and Encryption library for PHP.

1.8k99.6M101](/packages/namshi-jose)[league/oauth1-client

OAuth 1.0 Client Library

99698.8M106](/packages/league-oauth1-client)[bezhansalleh/filament-shield

Filament support for `spatie/laravel-permission`.

2.8k2.9M88](/packages/bezhansalleh-filament-shield)[gesdinet/jwt-refresh-token-bundle

Implements a refresh token system over Json Web Tokens in Symfony

70516.4M35](/packages/gesdinet-jwt-refresh-token-bundle)[league/oauth2-google

Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client

41721.2M118](/packages/league-oauth2-google)[illuminate/auth

The Illuminate Auth package.

9327.3M1.0k](/packages/illuminate-auth)

PHPackages © 2026

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