1. Go to this page and download the library: Download sitepoint/rauth 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/ */
sitepoint / rauth example snippets
$rauth = new Rauth();
namespace Paranoia;
/**
* Class MyProtectedClass
* @package Paranoia
*
* @auth-groups admin, reg-user
* @auth-permissions post-write, post-read
* @auth-mode OR
*
*/
class MyProtectedClass
{
try {
$allowed = $rauth->authorize($classInstanceOrName, $methodName, $attributes);
} catch (\SitePoint\Rauth\Exception\AuthException $e) {
$e->getType(); // will be "ban", "and", "or", etc...
$e->getReasons(); // an array of Reason objects with details
}