PHPackages                             wpler/module-user-management - 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. wpler/module-user-management

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

wpler/module-user-management
============================

User with improved RBAC

1.0.18(8y ago)150[3 issues](https://github.com/Stefan39/user-management/issues)BSD-3-ClausePHP

Since Nov 1Pushed 8y ago1 watchersCompare

[ Source](https://github.com/Stefan39/user-management)[ Packagist](https://packagist.org/packages/wpler/module-user-management)[ RSS](/packages/wpler-module-user-management/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (7)Versions (20)Used By (0)

User management module for Yii 2
================================

[](#user-management-module-for-yii-2)

This is a fork of [webvimark/user-management-module](https://github.com/webvimark/user-management) to further development for using SQLite and NoSQL databases.

In addition, this extension is to be extended to use Bootstrap 4 Styles by given module setting.

[![Latest Stable Version](https://camo.githubusercontent.com/27123b67c336d936889c55f8a22b74dd8b9fa9901bace83879dc0b9edde9b12d/68747470733a2f2f706f7365722e707567782e6f72672f77706c65722f6d6f64756c652d757365722d6d616e6167656d656e742f762f737461626c65)](https://packagist.org/packages/wpler/module-user-management)[![Latest Unstable Version](https://camo.githubusercontent.com/06cf44a75dd905ddf9c601b06d56dc8a26eb8e0a1c34bed4d79cb14581e0faa0/68747470733a2f2f706f7365722e707567782e6f72672f77706c65722f6d6f64756c652d757365722d6d616e6167656d656e742f762f756e737461626c65)](https://packagist.org/packages/wpler/module-user-management)[![Total Downloads](https://camo.githubusercontent.com/4d3c261396311e21b4c21acd3d9ec7b3349385ecf71b26556a078927573e0f4b/68747470733a2f2f706f7365722e707567782e6f72672f77706c65722f6d6f64756c652d757365722d6d616e6167656d656e742f646f776e6c6f616473)](https://packagist.org/packages/wpler/module-user-management)

Perks
-----

[](#perks)

- User management
- RBAC (roles, permissions and stuff) with web interface
- Registration, authorization, password recovery and so on
- Visit log
- Optimised (zero DB queries during usual user workflow)
- Nice widgets like GhostMenu or GhostHtml::a where elements are visible only if user has access to route where they point

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

[](#installation)

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

Either run

```
composer require wpler/module-user-management

```

or add

```
"wpler/module-user-management": "~1"

```

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

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

[](#configuration)

1. In your config/web.php

```
'components'=>[
	'user' => [
		'class' => 'wpler\modules\UserManagement\components\UserConfig',

		// Comment this if you don't want to record user logins
		'on afterLogin' => function($event) {
				\wpler\modules\UserManagement\models\UserVisitLog::newVisitor($event->identity->id);
			}
	],
],

'modules'=>[
	'user-management' => [
		'class' => 'wpler\modules\UserManagement\UserManagementModule',

		// 'enableRegistration' => true,

		// Add regexp validation to passwords. Default pattern does not restrict user and can enter any set of characters.
		// The example below allows user to enter :
		// any set of characters
		// (?=\S{8,}): of at least length 8
		// (?=\S*[a-z]): containing at least one lowercase letter
		// (?=\S*[A-Z]): and at least one uppercase letter
		// (?=\S*[\d]): and at least one number
		// $: anchored to the end of the string

		//'passwordRegexp' => '^\S*(?=\S{8,})(?=\S*[a-z])(?=\S*[A-Z])(?=\S*[\d])\S*$',

		// Here you can set your handler to change layout for any controller or action
		// Tip: you can use this event in any module
		'on beforeAction'=>function(yii\base\ActionEvent $event) {
				if ( $event->action->uniqueId == 'user-management/auth/login' )
				{
					$event->action->controller->layout = 'loginLayout.php';
				};
			},
	],
],
```

To learn about events check:

-
-

Layout handler example in *AuthHelper::layoutHandler()*

To see full list of options check *UserManagementModule* file

2. In your config/console.php (this is needed for migrations and working with console)

```
'modules'=>[
	'user-management' => [
		'class' => 'wpler\modules\UserManagement\UserManagementModule',
	        'controllerNamespace'=>'vendor\wpler\modules\UserManagement\controllers', // To prevent yii help from crashing
	],
],
```

3. Run migrations

```
./yii migrate --migrationPath=vendor/wpler/module-user-management/migrations/
```

4. In you base controller

```
public function behaviors()
{
	return [
		'ghost-access'=> [
			'class' => 'wpler\modules\UserManagement\components\GhostAccessControl',
		],
	];
}
```

Where you can go
----------------

[](#where-you-can-go)

```
