1. Go to this page and download the library: Download webiik/privileges 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 / privileges example snippets
$privileges = new \Webiik\Privileges\Privileges();
// Add roles
$privileges->addRole('user');
$privileges->addRole('admin');
// Add resources
$privileges->addResource('article', ['create', 'read', 'update', 'delete']);
// Allow access to resources
$privileges->allow('user', 'article', ['read']);
$privileges->allow('admin', 'article', ['all']);
// Test access to resources
if ($privileges->isAllowed('admin', 'article', 'update')) {
// Admin can update an article
}