PHP code example of createloop / php-rbac

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

    

createloop / php-rbac example snippets

 json
{
    "eateloop/php-rbac": "1.1.*@dev"
    }
}
 php
$rbac = new Rbac("user_id",new ProxyFactory(IStorage storage), IStorage storage);
$rbac->auth("controller/action/resource","get"); //return true or false
 php
$admin = new admin(new ProxyFactory(IStorage $storage), IStorage $storage);
$resource = $admin->createResource($name, $resource);
 php
$admin = new admin(new ProxyFactory(IStorage $storage), IStorage $storage);
$role = $resource = $admin->createRole($name);
 php
$role->addResource($resource);