1. Go to this page and download the library: Download dmitrymomot/php-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/ */
class CustomUser implements \Auth\Model\UserInterface {
//....realisation of interface
}
$model = '\Custom\Model\CustomUser'; // full path to class
$auth = new \Auth\Adapter\Database($model);
$auth->getUser('guest') // returns instance of class \Auth\Model\User or 'guest', if user isn't logged in
$auth->createUser(array('username' => 'test_user', 'password' => 'some_password', 'email' => '[email protected]', ...)); // returns boolean value or array error messages
$auth->updateUser(array('username' => 'test_user', 'password' => 'some_password', ....)); // returns boolean value or array error messages