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

Laravel Permission Manager Laravel Package

ahinest/laravel-permission-manager

A Laravel package for managing roles and permissions through an intuitive interface. Create, assign, and revoke permissions, organize access by role, and protect routes and UI elements with built-in middleware and Blade helpers.

View on GitHub
Deep Wiki
Context7

Getting Started

  • Install with composer require ahinest/laravel-permission-manager on a Laravel 12 app running PHP 8.2+ and already using spatie/laravel-permission ^6.25.
  • Read the README first, then the docs sections on the authorization model, delegation policies, auditing, migrations, and security boundaries. The P/Q/D delegation model is the key concept to understand before wiring it into an admin UI.
  • Publish and review config and migrations before running them. Confirm role hierarchy, administrative authority, reserved administrative identities, and host account-lifecycle contracts match your application’s existing user model.
  • Run migrations in staging against a copy of production, especially if you already have Spatie permission tables. The package advertises ownership-aware migrations and MariaDB/InnoDB support; verify table ownership and engine assumptions before applying.
  • First practical use case: replace ad-hoc admin role/permission assignment with the package’s authorized delegation flow, so role changes are policy-checked, transactional, audited, and protected against privilege escalation and last-admin lockout.

Implementation Patterns

  • Route all role and permission writes through the package’s manager/services rather than calling Spatie APIs or writing pivot tables directly. That is what gives you delegation policy enforcement, concurrency protection, audit records, and cache invalidation.
  • Model day-to-day admin workflows around delegation policies: define who may assign or revoke which roles/permissions, then let the package enforce those rules. Avoid granting broad “manage all permissions” authority when narrower delegated policies are possible.
  • Use the explicit P/Q/D delegation model as the core mental model for admin screens. Reflect its constraints in UI flows so users see why an assignment is allowed, denied, or requires a different actor.
  • Implement the host contracts for account lifecycle and reserved administrative identities early. Hook user deactivation, deletion, and reserved-account rules into those contracts so stale delegations and last-admin checks behave correctly.
  • Attach a correlation ID from the request, job, or admin action to authority changes. The transactional audit trail can then show effective permission differences and let you trace a support incident across logs and audit records.
  • Keep package calls inside short transactions. The package handles transactional RBAC writes with concurrency protection; do not hold a transaction open around unrelated application work.
  • If enabling the optional HTTP administration API, put it behind your existing admin authentication/authorization stack, rate-limit it, and audit access. Treat it as an internal admin surface, not a public API.
  • For admin panels, prefer package-provided authorization checks before rendering role/permission controls. Combine those checks with your Laravel policies so the UI and backend agree.
  • In tests, cover delegated assignment, revocation, privilege-escalation denial, last-eligible-admin protection, reserved identities, audit correlation, and cache behavior after commit and rollback.

Gotchas and Tips

  • This is Laravel 12 only. If the host app is still on Laravel 11 or earlier, this package is not a drop-in option yet.
  • The P/Q/D delegation model has a learning curve. Read the authorization-model docs before exposing delegation controls to non-technical admins; misunderstanding the model leads to confusing denials.
  • Privilege-escalation and last-admin protections will intentionally reject some operations that look valid in isolation. Design admin UX to explain those failures, and order bulk changes carefully so you do not strand the last eligible administrator.
  • Reserved administrative identities are protected. Check config before attempting to revoke or reassign those accounts; otherwise support scripts may fail unexpectedly.
  • Cache invalidation is reliable only when writes go through the package. Direct Spatie calls, raw SQL, or external scripts can bypass invalidation and leave effective permissions stale.
  • Review migrations carefully on existing installations. Ownership-aware migrations are helpful, but duplicate or conflicting Spatie tables and non-InnoDB engines can still cause deployment surprises.
  • Changing role hierarchy or administrative authority config can have wide blast radius. Test config changes in staging and verify who still has authority to manage roles after the change.
  • Correlation IDs are only useful if consistently propagated. Set them in middleware/jobs and include them in audit queries; otherwise the “effective differences” audit becomes harder to use during incidents.
  • The HTTP API is optional. If enabled, secure it deliberately with auth guards, authorization policies, CSRF/session or token strategy, and rate limits.
  • Rollbacks invalidate permission cache, but audit records should be treated as committed authority history. Do not assume every attempted admin action produced an audit record if the transaction failed.
  • For debugging, start with the audit trail, then check config hierarchy/reserved identities, then verify the write path actually used the package rather than bypassing it.
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.
shitoudev/permissionmanager
johannesclimacus/laravel-tui
hocvt/seotools
vitalybaev/sypexgeo
amphibee/themosis-ignition
gito-me/fast-excel
frankyso/laravel-ipaymu
geolize-studio/laravel-chile
boomerangui/chat
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