1. Go to this page and download the library: Download webiik/login 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/ */
webiik / login example snippets
$login = new \Webiik\Login\Login($token, $cookie, $session);
// Log-in the user with id 1
$login->login(1);
// Check if the user is logged in
if ($login->isLogged()) {
echo 'The user id ' . $login->getUserId() . ' is logged.';
} else {
echo 'The user is not logged.';
}
// Log the user out
$login->logout();
setSessionKey(string $sessionKey): void
$login->setSessionName('logged');
setNamespace(string $name): void
$login->setNamespace('en');
login($uid, bool $permanent = false): void
// Log in the user with id 1
$login->login(1);
// Permanently log in the user with id 1
$login->login(1, true);
setPermanentCookieName(string $name): void
$login->setPermanentCookieName('PC');
setPermanentLoginStorage(callable $factory, int $days = 30): void