p2made / yii2-p2y2-users
Users & RBAC modules.
Installs: 10
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 104
Type:yii2-extension
Requires
- php: >=5.4.0
- p2made/yii2-p2y2-base: ^1.1
- p2made/yii2-p2y2-moment: ^2.0
- yiisoft/yii2: ^2.0
- yiisoft/yii2-authclient: ^2.1
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-04 22:21:26 UTC
README
¡¡¡ ===== NOT READY FOR USE ===== !!!
Yii 2 Users & RBAC
Installation
The preferred way to install P2Y2 Users is through composer. Depending on your composer installation, run one of the following commands:
composer require p2made/yii2-p2y2-users "^0.2"
or
php composer.phar require p2made/yii2-p2y2-users "^0.2"
Alternatively add:
"p2made/yii2-p2y2-users": "^0.2"
to the requires section of your composer.json
file & P2Y2 Users will be
installed next time you run composer update
.
And then...
-
Configure your database. Edit
common/config/main-local.php
in yii2-advanced-app, orapp/config/db.php
in yii2-basic-app, to include...'components' => [ 'db' => [ 'class' => 'yii\db\Connection', 'dsn' => 'mysql:host=localhost;dbname=your_yii_app_db', 'username' => 'your_yii_app_db_user', 'password' => 'your_yii_app_db_password', 'tablePrefix' => 'tbl_', 'charset' => 'utf8', ], ... ],
I recommend following the common practice of configuring the database with the username,
your_yii_app_db_user
, the same as the database name,your_yii_app_db
. -
Now edit
common/config/main.php
in yii2-advanced-app, orapp/config/web.php
in yii2-basic-app to include...'components' => [ 'user' => [ 'class' => 'p2m\users\components\User', ], ... ], 'modules' => [ 'user' => [ 'class' => 'p2m\users\modules\UsersModule', ], ... ],
In
yii2-advanced-app
may have these configured atfrontend/config/main.php
&backend/config/main.php
. However since these will all be the same for both ends, it's best to keep only one copy incommon/config
. If there are user configurations in either of those files, remove them or comment them out.
-
Now configure the mailer...
- In yii2-advanced-app, either...
common/config/main.php
orcommon/config/main-local.php
- In yii2-basic-app,
app/config/web.php
'components' => [ 'mailer' => [ 'class' => 'yii\swiftmailer\Mailer', 'useFileTransport' => true, 'messageConfig' => [ 'from' => ['admin@website.com' => 'Admin'], 'charset' => 'UTF-8', ] ], ],
- In yii2-advanced-app, either...
-
Optionally perform any customisation in
common/config/params.php
in yii2-advanced-app, orapp/config/params.php
in yii2-basic-app, to include...... 'p2m' => [ ... 'users' => [ 'requireEmail' => true, 'requireUsername' => false, 'useEmail' => true, 'useUsername' => true, 'loginEmail' => true, 'loginUsername' => true, 'loginDuration' => 2551443, // one mean lunar month 'emailConfirmation' => true, 'emailChangeConfirmation' => true, 'loginRedirect' => null, 'logoutRedirect' => null, 'resetExpireTime' => '2 days', 'loginExpireTime' => '15 minutes', 'usersEmailViewPath' => '@user/mail', 'usersForceTranslation' => false, 'usersModelClasses' => [], ], ],
Settings above are the defaults & only need to be set if you want to change them.
p2p
is the params space for setting all of my Yii2 packages.