PHP code example of yiicod / yii2-auth
1. Go to this page and download the library: Download yiicod/yii2-auth library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yiicod / yii2-auth example snippets
php yii migrate/up --migrationPath=@yiicod/auth/migrations
'i18n' => [
'translations' => [
'*' => [
'class' => 'yii\i18n\PhpMessageSource'
],
],
],
'components' => [
'auth' => [
'class' => 'yiicod\auth\Auth',
],
]
'bootstrap' => ['auth']
/**
* Declares class-based actions.
* For change functional use AuthUserBehavior.
* Auth events:
*
* - beforeLogin(ActionEvent)
* - afterLogin(ActionEvent)
* - errorLogin(ActionEvent)
*
* - beforeSignup(ActionEvent)
* - afterSignup(ActionEvent)
* - errorSignup(ActionEvent)
*
* - beforeCheckRecoveryKey(ActionEvent)
* - afterCheckRecoveryKey(ActionEvent)
* - errorCheckRecoveryKey(ActionEvent)
*
* - beforeForgot(ActionEvent)
* - afterForgot(ActionEvent)
* - errorForgot(ActionEvent)
*
* - beforeLogout(ActionEvent)
* - afterLogout(ActionEvent)
*
*
* Global events
* yiicod.auth.controllers.webUser.[Action class name].[Event name (beforeLogin)]
*
*
*/
public function actions()
{
return ArrayHelper::merge(parent::actions(), [
'login' => [
'class' => \yiicod\auth\actions\webUser\LoginAction::className(),
],
'requestPasswordReset' => [
'class' => \yiicod\auth\actions\webUser\RequestPasswordResetAction::className(),
],
'logout' => [
'class' => \yiicod\auth\actions\webUser\LogoutAction::className(),
],
'signup' => [
'class' => \yiicod\auth\actions\webUser\SignupAction::className(),
],
'resetPassword' => [
'class' => \yiicod\auth\actions\webUser\ResetPasswordAction::className(),
],
]
);
}
php composer.phar