Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Role Based Access Control Bundle Laravel Package

tourze/role-based-access-control-bundle

A Symfony bundle for role-based access control (RBAC), offering roles, permissions, and access checks that integrate with your app's security layer. Configure roles and permissions to restrict resources and actions across your application.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by inspecting composer.json and README.md in the package root. Tourze packages are typically Symfony bundles ("type": "symfony-bundle"), so confirm whether any Laravel auto-discovery metadata (extra.laravel.providers) exists—likely it does not. Look first at DependencyInjection/, Entity/ or Model/, and Security/ directories to understand the RBAC model. Minimal steps: require the package, manually bind its services in a Laravel service provider, create role and permission records, assign a role to a user, and call the package’s access-checking service. First use case: gate an admin route—e.g. Route::get('/admin', ...)->middleware('can:admin.access')—by defining a Laravel Gate that delegates to the package’s access decision logic. Expect to write that bridge yourself.

Implementation Patterns

Treat the package as an RBAC engine rather than a Laravel drop-in. Pattern 1: seed roles and permissions in a seeder, attach permissions to roles through the package’s repository or service, and assign roles to users via your own pivot table if the package expects Symfony user objects. Pattern 2: wrap access checks in Laravel middleware—resolve the package’s access checker, call something like isGranted($user, $permission), and abort with 403 on failure. Pattern 3: integrate with Laravel Gates: Gate::define('edit-posts', fn ($user) => $checker->isGranted($user, 'post.edit')); so Blade @can and can: middleware work naturally. Pattern 4: cache the user-permission map (Redis, Laravel cache) because RBAC checks are frequent; invalidate it when roles or assignments change. For workflows, keep role definitions in config or database, use role hierarchy if supported, and audit assignments. If the package exposes voters or role providers, bind custom implementations in your service provider to adapt to Eloquent models.

Gotchas and Tips

  • Version 0.0.1 is pre-stable: the release notes are empty, there is no changelog detail, and there are no compatibility guarantees. Pin the exact version and isolate the integration behind an interface.
  • The name ends in -bundle; it likely depends on Symfony Security, Doctrine, or Symfony DI. Laravel uses Eloquent and Illuminate components—expect conflicts or missing bridges. Check composer.json for symfony/* and doctrine/* constraints before installing.
  • No Laravel service provider means no vendor:publish for configuration. Symfony bundle config is usually loaded via Configuration classes; you may need to instantiate and configure services manually.
  • Debugging: dump container bindings (app()->getBindings()) to see what the package registers; add Log::debug around access checks. If checks always fail, verify the user object implements the interface the package expects (e.g. Symfony\Component\Security\Core\User\UserInterface).
  • Extension points: custom role hierarchy, permission voters, and cache adapters are the likely flex points—but they are undocumented at 0.0.1. Read source tests, if any, for expected usage.
  • Avoid relying on this package for production authorization until you have tests covering role assignment, permission inheritance, and cache invalidation. Consider Laravel-native alternatives (spatie/laravel-permission, Gate/Policy) unless you specifically need this package’s RBAC model.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jinas/dhivatar
store-doc/laravel-storage-driver
plus-it/laravel-translation-manager
diephp/perhaps
diephp/telegraph
osmaviation/spreadsheet
microsoft/fluentui-system-icons
mmccook/php-json-canonicalization-scheme
middlewares/firewall
qubiqx/montapacking
nyoncode/laravel-package-console
pnscripts/filament-broadquill-lite
pnscripts/laravel-sentfold-lite
vleap/mx-sdk-laravel-internal
twidpay/utils
htetmyathlaing/scout-elasticsearch-driver
artisan-toolbox/front-awesome
ls/client-assistant
users-au/laravel-client
cgv/localized-resource