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

ActiveLibrary

ybsisgood/module-user-management
================================

ybsisgood module, and some modifications

1.1.0(1y ago)051↓100%PHP

Since Apr 25Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ybsisgood/user-management)[ Packagist](https://packagist.org/packages/ybsisgood/module-user-management)[ RSS](/packages/ybsisgood-module-user-management/feed)WikiDiscussions main Synced 1mo ago

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

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

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

`Original Repo : https://github.com/ybsisgood/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 ybsisgood/module-user-management

```

or add

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

```

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

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

[](#configuration)

1. In your config/web.php

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

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

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

3. Run migrations

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

4. In you base controller

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

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

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

```
