PHP code example of luizpinheiro / acl

1. Go to this page and download the library: Download luizpinheiro/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/ */

    

luizpinheiro / acl example snippets



#Put this on the boostrap of your application
use ACL\ACL;

ACL::setRolesManager($roleManager) 
ACL::setPermissionsManager($permissionsManager);
ACL::setGroupsManager($groupsManager);

#you should tell the ACL who is the user, you should do this in your authorization
#layer
ACL::setUserId($user_id);

#now you can check if the user has the permission
ACL::hasPermission('documents.delete');