1. Go to this page and download the library: Download synopsie/olymp-permission 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/ */
synopsie / olymp-permission example snippets
composer
$manager = new olymp\PermissionManager();
enum PermissionsBase : string {
case PERMISSION_BASE = "synopsie.permission.base";
/**
* @throws MissingPermissionException
*/
public static function getPermission(string $permissionName) : string {
return match ($permissionName) {
'base' => self::PERMISSION_BASE->value,
default => throw new MissingPermissionException("Permission $permissionName not found")
};
}
}
$manager->registerEnum(PermissionsBase::cases());
class PermissionsBase {
public const PERMISSION_BASE = "synopsie.permission.base";
}