colbeh/access
Colbeh Access is a lightweight Laravel package for managing user access and permissions in your app. Add simple role/permission checks, protect routes and actions, and keep authorization logic organized with minimal setup.
can(), hasRole()).auth:admin).Policy classes, it offers a simpler alternative for projects where fine-grained permissions aren’t critical.spatie/laravel-permission), but no hard dependencies on core Laravel features.config/access.php), allowing alignment with existing naming conventions (e.g., roles like super_admin vs. admin).sadeghbarout) with no clear governance model. Risk of abandonment or breaking changes.hasPermission()) could become bottlenecks in high-traffic apps without indexing.admin → editor)? The package lacks explicit support for this.can()) be extended for domain-specific rules?Auth::user() and middleware, but requires manual setup for non-standard auth systems.roles and permissions tables (or extend existing ones).Schema::create('roles', function (Blueprint $table) {
$table->id();
$table->string('name')->unique();
$table->timestamps();
});
user_role) or a role_id column on the users table.$user->attachRole('admin'); // If using pivot
app/Http/Kernel.php:
protected $routeMiddleware = [
'role' => \Colbeh\Access\Http\Middleware\RoleMiddleware::class,
];
Route::middleware(['auth', 'role:admin'])->group(function () { ... });
PermissionService or create custom policies for complex logic.actingAs()) to validate permission checks.config/access.php, reducing scattered permission logic.PermissionService or middleware.$user->load('roles.permissions');
hasPermission() calls:
Cache::remember("user-{$user->id}-permissions", now()->addHours(1), fn() => $user->permissions);
is_admin flag on users table).Cache::forget()).How can I help you explore Laravel packages today?