Download the PHP package syftnex/laravel-role-enums without Composer
On this page you can find all versions of the php package syftnex/laravel-role-enums. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download syftnex/laravel-role-enums
More information about syftnex/laravel-role-enums
Files in syftnex/laravel-role-enums
Package laravel-role-enums
Short Description Infrastructure to use PHP Backed Enums as roles in Laravel.
License MIT
Homepage https://github.com/syftnex/laravel-role-enums
Informations about the package laravel-role-enums
Laravel Role Enums
Infrastructure package to use PHP Backed Enums as roles in Laravel.
This package ships infrastructure only. It does not ship any pre-defined roles.
Installation
Publish package files:
Configuration
config/role-enums.php
Route Middleware
role:{alias},{value}[,{value2},...][,{column}]does strict match checks and accepts OR logic across multiple values.role.min:{alias},{value}[,{column}]callsisAtLeast()when available on your enum.- For explicit columns, keep the column as the final parameter (example:
role:org,owner,org_role).
Blade Directives
Blade checks are guest-safe and return false when no user is authenticated.
Optional directive renaming in config:
HasRole Trait
If an enum does not implement isAtLeast(), isAtLeastRole() throws UnsupportedOperationException.
whereAtLeastRole() throws the same exception when the enum does not support hierarchy checks.
Enum options() helper
Generator
Generates:
app/Enums/UserStatus.phpdatabase/migrations/*_add_user_status_to_users_table.phpapp/Traits/HasUserStatusRole.php
Generated stubs are parseable PHP and include commented guidance for enum cases,
optional hierarchy (isAtLeast), and model cast examples.
What This Package Does Not Do
- Does not ship pre-defined role enums or cases.
- Does not create role/permission tables.
- Does not define how roles map to permissions.
- Does not replace Gates or Policies.
Quality Commands
composer coverage requires an installed PHP coverage driver (xdebug or pcov).