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

ActiveLibrary

uzzielpelawak/module-user-management
====================================

uzzielpelawak module, and some modifications

v2.0.4(3y ago)132PHP

Since Nov 1Pushed 2y agoCompare

[ Source](https://github.com/uzzielpelawak/user-management)[ Packagist](https://packagist.org/packages/uzzielpelawak/module-user-management)[ RSS](/packages/uzzielpelawak-module-user-management/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (7)Versions (20)Used By (0)

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

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

`Original Repo : https://github.com/uzzielpelawak/user-management`

Update
------

[](#update)

- Compatible Admin LTE 3
- Support PHP &gt;= 8.0

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 uzzielpelawak/module-user-management

```

or add

```
"uzzielpelawak/module-user-management": "^2"

```

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

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

[](#configuration)

1. In your config/web.php

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

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

'modules'=>[
	'user-management' => [
		'class' => 'uzzielpelawak\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' => 'uzzielpelawak\modules\UserManagement\UserManagementModule',
	        'controllerNamespace'=>'vendor\uzzielpelawak\modules\UserManagement\controllers', // To prevent yii help from crashing
	],
],
```

3. Run migrations

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

4. In you base controller

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

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

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

```
