PHP Class amnah\yii2\user\Module

Author: amnah ([email protected])
Inheritance: extends yii\base\Module, implements yii\base\BootstrapInterface
Show file Open project: amnah/yii2-user Class Usage Examples

Public Properties

Property Type Description
$alias Alias for module
$emailChangeConfirmation If true, users will have to confirm their email address after changing it on the account page
$emailConfirmation If true, users will have to confirm their email address after registering (= email activation)
$emailViewPath Email view path
$loginDuration Login duration
$loginEmail If true, users can log in using their email
$loginExpireTime Login via email token expiration (passed to strtotime())
$loginRedirect Url to redirect to after logging in. If null, will redirect to home page. Note that AccessControl takes precedence over this (see [[yii\web\User::loginRequired()]])
$loginUsername If true, users can log in using their username
$logoutRedirect Url to redirect to after logging out. If null, will redirect to home page
$modelClasses Model classes, e.g., ["User" => "amnah\yii2\user\models\User"] Usage: $user = Yii::$app->getModule("user")->model("User", $config); (equivalent to) $user = new \amnah\yii2\user\models\User($config); The model classes here will be merged with/override the [[getDefaultModelClasses()|default ones]]
$requireEmail If true, users are required to enter an email
$requireUsername If true, users are required to enter a username
$resetExpireTime Reset password token expiration (passed to strtotime())
$useEmail If true, users can enter an email. This is automatically set to true if $requireEmail = true
$useUsername If true, users can enter a username. This is automatically set to true if $requireUsername = true

Protected Properties

Property Type Description
$version Module version

Public Methods

Method Description
createController ( $route ) Modify createController() to handle routes in the default controller
getActions ( ) Get a list of actions for this module. Used for debugging/initial installations
getVersion ( ) : string Get module version
init ( )
model ( string $name, array $config = [] ) : ActiveRecord Get object instance of model

Protected Methods

Method Description
checkModuleProperties ( ) Check for valid email/username properties
getDefaultModelClasses ( ) Get default model classes

Method Details

checkModuleProperties() protected method

Check for valid email/username properties
protected checkModuleProperties ( )

createController() public method

This is needed because of the way we map actions to "user/default/". We can't use module bootstrapping because that doesn't work when urlManager.enablePrettyUrl = false. Additionally, this requires one less step during installation
public createController ( $route )

getActions() public method

Get a list of actions for this module. Used for debugging/initial installations
public getActions ( )

getDefaultModelClasses() protected method

Get default model classes
protected getDefaultModelClasses ( )

getVersion() public method

Get module version
public getVersion ( ) : string
return string

init() public method

public init ( )

model() public method

Get object instance of model
public model ( string $name, array $config = [] ) : ActiveRecord
$name string
$config array
return yii\db\ActiveRecord

Property Details

$alias public property

Alias for module
public $alias

$emailChangeConfirmation public property

If true, users will have to confirm their email address after changing it on the account page
public $emailChangeConfirmation

$emailConfirmation public property

If true, users will have to confirm their email address after registering (= email activation)
public $emailConfirmation

$emailViewPath public property

Email view path
public $emailViewPath

$loginDuration public property

Login duration
public $loginDuration

$loginEmail public property

If true, users can log in using their email
public $loginEmail

$loginExpireTime public property

Login via email token expiration (passed to strtotime())
public $loginExpireTime

$loginRedirect public property

Url to redirect to after logging in. If null, will redirect to home page. Note that AccessControl takes precedence over this (see [[yii\web\User::loginRequired()]])
public $loginRedirect

$loginUsername public property

If true, users can log in using their username
public $loginUsername

$logoutRedirect public property

Url to redirect to after logging out. If null, will redirect to home page
public $logoutRedirect

$modelClasses public property

Model classes, e.g., ["User" => "amnah\yii2\user\models\User"] Usage: $user = Yii::$app->getModule("user")->model("User", $config); (equivalent to) $user = new \amnah\yii2\user\models\User($config); The model classes here will be merged with/override the [[getDefaultModelClasses()|default ones]]
public $modelClasses

$requireEmail public property

If true, users are required to enter an email
public $requireEmail

$requireUsername public property

If true, users are required to enter a username
public $requireUsername

$resetExpireTime public property

Reset password token expiration (passed to strtotime())
public $resetExpireTime

$useEmail public property

If true, users can enter an email. This is automatically set to true if $requireEmail = true
public $useEmail

$useUsername public property

If true, users can enter a username. This is automatically set to true if $requireUsername = true
public $useUsername

$version protected property

Module version
protected $version