PHP code example of killbond / yii2-auth

1. Go to this page and download the library: Download killbond/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/ */

    

killbond / yii2-auth example snippets


return [
	'modules' => [
	    ...
	        'auth' => [
	            'class' => 'auth\Module',
	            'layout' => '//homepage', // Layout when not logged in yet
	            'layoutLogged' => '//main', // Layout for logged in users
	            'attemptsBeforeCaptcha' => 3, // Optional
	            'supportEmail' => '[email protected]', // Email for notifications
	            'passwordResetTokenExpire' => 3600, // Seconds for token expiration
	            'superAdmins' => ['admin'], // SuperAdmin users
	            'tableMap' => [ // Optional, but if defined, all must be declared
	                'User' => 'user',
	                'UserStatus' => 'user_status',
	                'ProfileFieldValue' => 'profile_field_value',
	                'ProfileField' => 'profile_field',
	                'ProfileFieldType' => 'profile_field_type',
	            ],
	        ],
	    ...
	],
	...
	'components' => [
	    ...
		'authManager' => [
			'class' => '\yii\rbac\DbManager',
			'ruleTable' => 'AuthRule', // Optional
			'itemTable' => 'AuthItem',  // Optional
			'itemChildTable' => 'AuthItemChild',  // Optional
			'assignmentTable' => 'AuthAssignment',  // Optional
		],
		'user' => [
			'class' => 'auth\components\User',
			'identityClass' => 'auth\models\User', // or replace to your custom identityClass
			'enableAutoLogin' => true,
		],
	    ...
	]
];

$ php composer.phar