PHP code example of albertotain / user-manager

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

    

albertotain / user-manager example snippets

bash
 $this->loadComponent('FormProtection');

 $this->loadComponent('Auth', [
		'loginAction' => [
			'plugin' => 'UserManager',
			'controller' => 'Users',
			'action' => 'login',
            'prefix' => false
		],
		'loginRedirect' => [
			'plugin' => 'UserManager',
			'controller' => 'Users',
			'action' => 'index',
            'prefix' => false
		],
		'logoutRedirect' => [
			'plugin' => 'UserManager',
			'controller' => 'Users',
			'action' => 'login',
			'prefix' => false
		],
		'unauthorizedRedirect' => [
			'plugin' => 'UserManager',
			'controller' => 'Users',
			'action' => 'login',
			'prefix' => false
		],
		'authError' => __('Acceso no permitido.'),
		'authenticate' => ['Form' => ['fields' => ['username' => 'email']]],
		'storage' => 'Session',
		'autoRedirect' => false
	]);