1. Go to this page and download the library: Download germania-kg/user-roles 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 / user-roles example snippets
use Germania\UserRoles\PdoAssignUserToRole;
$pdo = new PDO( ... );
$logger = new Monolog();
// Default, thus optional
$table = 'users_roles_mm';
$assigner = new PdoAssignUserToRole( $pdo, $logger, $table);
$user_id = 42;
$assigner( $user_id, 1); // e.g. Admins
$assigner( $user_id, 2); // e.g. Co-workers
$assigner( $user_id, 10); // e.g. Sales people
use Germania\UserRoles\PdoUserRoles;
$pdo = new PDO( ... );
// Default, thus optional
$table = 'users_roles_mm';
$roles_finder = new PdoUserRoles( $pdo, $table);
$user_id = 42;
$roles_array = $roles_finder( $user_id );
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.