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

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

infoburp/yii2-user
==================

Yii 2 user authentication module

5.1.2(8y ago)0411MITPHP

Since Apr 17Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (3)Versions (25)Used By (0)

Yii 2 User
==========

[](#yii-2-user)

Yii 2 User - User authentication module

Integrated with yii2-otp by infoburp, with thanks to sam002
-----------------------------------------------------------

[](#integrated-with-yii2-otp-by-infoburp-with-thanks-to-sam002)

New version released 01/31/2016
-------------------------------

[](#new-version-released-01312016)

This release contains a few small updates and bug fixes. Most notably, I've changed `LoginForm.username` to `LoginForm.email` and added a timezone field to `app\models\Profile`(thanks [mnglkhn](https://github.com/amnah/yii2-user/pull/127))

If there are any issues, [let me know](https://github.com/amnah/yii2-user/issues) and I'll get to it asap.

Demo
----

[](#demo)

- [Demo](http://yii2.amnahdev.com/user)

Features
--------

[](#features)

- Quick setup - works out of the box so you can see what it does
- Easily [extendable](#how-do-i-extend-this-package)
- Registration using email and/or username
- Login using email and/or username
- Login/register via email (enter email &gt; get link in inbox &gt; click link to login/register)
- Email confirmation (+ resend functionality)
- [Social authentication](SOCIAL.md) (facebook, twitter, google, linkedin, reddit, vkontakte)
- Account page
    - Updates email, username, and password
    - Requires current password
- Profile page
    - Lists custom fields for users, e.g., *full\_name*
- Password recovery
- Admin crud via GridView

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

[](#installation)

- Install [Yii 2](http://www.yiiframework.com/download) using your preferred method
- Install package via [composer](http://getcomposer.org/download/) `"amnah/yii2-user": "^5.0"`
- Update config file *config/web.php* and *config/db.php*

```
// app/config/web.php
return [
    'components' => [
        // NOTE: in the yii2-advanced-app, the user component should be updated in
        // 'frontend/config/main.php' and/or 'backend/config/main.php' (OR you can add it
        // to 'common/config' if you remove it from frontend/backend)
        'user' => [
            'class' => 'app\modules\user\components\User',
        ],
        'mailer' => [
            'class' => 'yii\swiftmailer\Mailer',
            'useFileTransport' => true,
            'messageConfig' => [
                'from' => ['admin@website.com' => 'Admin'], // this is needed for sending emails
                'charset' => 'UTF-8',
            ]
        ],
    ],
    'modules' => [
        'user' => [
            'class' => 'app\modules\user\Module',
            // set custom module properties here ...
        ],
    ],
];
// app/config/db.php
return [
    'class' => 'yii\db\Connection',
    // set up db info
];
```

- Run migration file
    - `php yii migrate --migrationPath=@vendor/amnah/yii2-user/migrations`
- Go to your application in your browser
    - `http://localhost/pathtoapp/web/user`
- Log in as admin using `neo/neo` (change it!)
- Set up [module properties](Module.php#L14) as desired
- *Optional* - Update the nav links in your main layout *app/views/layouts/main.php*

```
// app/views/layouts/main.php
