There is no license information available for the latest version (dev-main) of this package.

Flexible user registration and authentication module for Yii3



Flexible user registration and authentication module for Yii3.

Total Downloads bulma boostrap5 tailwind codecov

Directory structure

  config/             contains application configurations
  messages            contains translations for all languages
  src/                application directory
      Action          contains action controller classes
      ActiveRecord    contains active record classes
      Form            contains form classes
      Helper          contains helper classes
      Middleware      contains class middleware
      Migration       contains migration classes
      Repository      contains repository classes
      Service         contains service classes


In this link you will find the lists of tasks to implement: task-list


Yiisoft application template yiisoft/app

composer create-project --prefer-dist --stability=dev yiisoft/app <your project>

Bootstrap5 css framework

cd <your project>
composer require yii-extension/user:@dev yii-extension/user-view-bootstrap5:@dev
composer require yii-extension/asset-bootstrap5:1.0.x 

Bulma css framework

cd <your project>
composer require yii-extension/user:@dev yii-extension/user-view-bulma:@dev
composer require yii-extension/asset-bulma:1.0.x

Tailwind css framework

cd <your project>
composer require yii-extension/user:@dev yii-extension/user-view-tailwind:@dev
composer require yii-extension/yii-extension/asset-tailwind:1.0.x

Install your driver for the database, for example sqlite

cd <your project>
composer require yiisoft/db-sqlite:3.0.x

Setup configuration

Add authentication configuration to your application config file: config/web/auth.php



use Yiisoft\Definitions\Reference;
use Yiisoft\Session\SessionInterface;
use Yiisoft\User\CurrentUser;

return [
    CurrentUser::class => [
        'withSession()' => [Reference::to(SessionInterface::class)],
        'reset' => function () {

Add connection configuration to your application config file: config/common/db.php



use Yiisoft\Db\Connection\ConnectionInterface;
use Yiisoft\Db\Sqlite\Connection;

return [
    ConnectionInterface::class => [
        'class' => Connection::class,
        '__construct()' => [
            'dsn' => 'sqlite:'. 'Your dsn',

Add configuration assets to your application config file: src/Asset/AppAsset.php, for example Bootstrap5:



namespace App\Asset;

use Yii\Extension\Asset\Bootstrap5\Bootstrap5Asset;
use Yiisoft\Assets\AssetBundle;

final class AppAsset extends AssetBundle
    public ?string $basePath = '@assets';
    public ?string $baseUrl = '@assetsUrl';
    public ?string $sourcePath = '@resources/assets/css';

    public array $css = [

    public array $depends = [

Run command console


Run migration

Application template:

./yii migrate/up

Using PHP built-in server

php -S -t public

Wait till it is up, then open the following URL in your browser


Includes the following features:

  • User module:
    • [/login] - Display login form.
    • [/logout] - Log the user out.
    • [/confirm[/{id}/{token}]] - Confirms a user (requires id and token query params).
    • [/profile] - Displays profile form.
    • [/register] - Displays registration form.
    • [/request] - Displays recovery request form.
    • [/resend] - Displays resend form.
    • [/reset[/{id}/{token}]] - Displays password reset form (requires id and token query params).
    • [/email/change] - Displays email change form.
    • [/email/attempt[/{id}/{token}]] - Confirm email change (requires id and token query params).

Note: check the directory /runtime/mail, the emails are stored in it.

Codeception testing

The package is tested with Codeception. To run tests:

php -S -t tests/_data/public > /dev/null 2>&1&
vendor/bin/codecept run Unit,Acceptance,Functional

Static analysis

The code is statically analyzed with Psalm. To run static analysis:


Quality of code

Codacy Badge static analysis type-coverage


The yii-extension/user is free software. It is released under the terms of the BSD License. Please see LICENSE for more information.

Maintained by Yii Extension.

Support the project

Open Collective

Powered by Yii Framework

Official website