PHP code example of germania-kg / permissions

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

    

germania-kg / permissions example snippets



use Germania\Permissions\PermissionsAcl;

// Have your PDO and optional a PSR-3 Logger at hand
$pdo    = new PDO;
$logger = new Monolog;

// Pass PDO and table names,
// optionally with PSR-3 Logger
$perms = new PermissionsAcl( $pdo, "permissions", "permissions_roles" );
$perms = new PermissionsAcl( $pdo, "permissions", "permissions_roles", $logger );

// Use Callable
$acl = $perms();

print_r( $acl );

// Keys are permissions;
// Element arrays are roles
(
    [bar] => Array
        (
            [0] => 1
        )

    [foo] => Array
        (
            [0] => 1
            [1] => 2
        )

    [quc] => Array
        (
        )

)