PHP code example of mikemclin / php-acl
1. Go to this page and download the library: Download mikemclin/php-acl 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/ */
mikemclin / php-acl example snippets
// Setup some abilities
$acl->addAbility('moderator', 'ban_users');
$acl->addAbility('admin', 'create_users');
// Add moderator role to the current user
$acl->attachRole('moderator');
// Check if the current user has these permissions
$acl->can('ban_users'); // returns true
$acl->can('create_users'); // returns false