1. Go to this page and download the library: Download initphp/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/ */
/** @var \InitPHP\Auth\Permission $perm */
$perm->is('admin', 'editor'); // True if "admin" or "editor" privileges. Returns false if none of the specified are present.
$perm->remove('admin', 'editor'); // Removes the specified permissions. And returns the actual number of permissions removed.
$perm->push('admin', 'editor'); // Adds the specified permissions. Returns the number of permissions added.
use InitPHP\Auth\Segment;
$auth = Segment::create('authorization', Segment::ADAPTER_COOKIE, [
'salt' => 'QO.@zeZiFgSvQd-:' // It is used to verify that the data in this cookie has not changed. Define a unique and secret string of at least 8 characters.
]);