1. Go to this page and download the library: Download solution10/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/ */
solution10 / auth example snippets
// The storage delegate handles reading/writing User data from
// your data store. That could be a database, REST service, whatever.
$storageDelegate = new PDOStorageDelegate();
// The session delegate handles maintaining state between
// page loads. Essentially, it's a front to the $_SESSION array,
// but if you do it different, you can re-implement!
$sessionDelegate = new Solution10\Auth\Driver\Session();
// Fire up a new instance called "MyAuth"
$auth = new Solution10\Auth\Auth('MyAuth', $sessionDelegate, $storageDelegate);
// Play with some API methods:
if ($auth->loggedIn()) {
echo 'Hi, '.$auth->user()->username.', welcome to the site!';
}
if ($auth->login($username, $password)) {
echo 'User was logged in!';
} else {
echo 'Please check your username and password.';
}
$auth->logout();
if ($auth->loggedIn())) {
echo "You're logged in!";
} else {
echo "You are not logged in :(";
}
$user = $auth->user();
// The $user object needs to be a class that implements the
// Solution10\Auth\UserRepresentation interface.
// It's a tiny interface, but it just gives us enough info to
// do our work.
$user = new UserRepresentationInstance();
$user->forceLogin($user);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.