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 Laravel Package

amir/laravel-permission

Role and permission management for Laravel apps, with migrations, middleware, Blade directives, and Eloquent traits for assigning roles and abilities to users.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit The package targets the standard Laravel authorization surface: an Eloquent trait on the User model, published migrations for roles/permissions/pivot tables, service-provider auto-discovery, and binding into Laravel's Gate so can()/@can keep working. That means it can slot in without changing controller-level authorization idioms, which is the main thing a TPM should care about — the blast radius is the data model and the seeding path, not the application code.

The naming is the first thing to flag. amir/laravel-permission is one character away from spatie/laravel-permission, the de facto standard with a five-figure star count and thousands of dependents. Any engineer reading a ticket, a README, or a Stack Overflow answer will assume Spatie semantics. Treat the two as incompatible mental models until proven otherwise, and expect to spend review time correcting assumptions rather than code.

Integration feasibility Mechanically trivial: composer require, publish config and migrations, add the trait, run migrations, seed roles. A competent Laravel engineer can produce a working spike in under a day. The real feasibility question is not "can we install it" but "can we staff it" — 47 stars and zero dependents means there is no public corpus of production war stories, no third-party tutorials, no ecosystem of companion packages (admin UIs, Nova/Filament integrations, tenant-aware extensions). Every edge case becomes a first-principles investigation.

Technical risk

  • Supply chain / bus factor. A single maintainer, no organizational backing, no visible security disclosure process. A compromised or abandoned release has no downstream community to notice quickly. Mitigate by pinning to an exact version and vendoring or forking.
  • Dependency confusion. Low-trust package names adjacent to a dominant package are a known attack vector and a known engineer-error vector. Enforce exact package names in composer.json and review every lockfile diff.
  • Unvalidated performance envelope. Permission checks typically run many times per request. Whether this package caches the role/permission graph in memory, per-request, or hits the database on every can() call determines whether it is viable at all under load. This is the single most important thing to verify empirically.
  • Version drift. Confirm the composer.json constraints against our actual Laravel and PHP versions; a package last released December 2024 may not yet declare support for the newest major.
  • Schema ownership. Once migrations land, the table shapes are ours to maintain. There is no upstream guarantee of migration compatibility across majors.

Key questions

  1. Does it cache the permission graph, and is the cache invalidated on role/permission mutation? What is the query count for N checks in one request?
  2. Does it support multi-tenancy or "teams" scoping, or is it global-only? If global-only, does that match our product's authorization model?
  3. What are the declared Laravel/PHP support constraints, and is there a CI matrix proving them?
  4. Is there a documented upgrade path, changelog, and semver discipline?
  5. Are there tests in the repository, and what is coverage of the authorization decision path?
  6. Can we get a written commitment (internal) to fork and maintain if upstream stalls?
  7. Does it conflict at the Composer level with spatie/laravel-permission if both are ever installed?

Integration Approach

Stack fit Assume a conventional Laravel monolith or modular monolith on PHP 8.x. Fit is good for a single-tenant app with a simple role → permission → user model and a small number of guarded resources. Fit degrades quickly for multi-tenant SaaS, per-object/record-level permissions, or anything needing delegation, approval workflows, or policy composition — those are exactly the areas where an unproven package forces you to write the missing layer yourself, at which point the package is contributing migrations and not much else.

Migration path If we are already on Spatie, do not migrate. The API shapes look similar enough to be dangerous — same trait name, same hasRole/can vocabulary, different table names, different caching semantics, different pivot columns. A migration is a schema rewrite plus an audit of every gate, policy, Blade directive, and seeder, with a silent-failure risk: a check that used to pass returns false and the UI simply hides a button. That is a bug class that survives QA.

If we are greenfield or on hand-rolled is_admin flags, migration is genuinely cheap — one sprint-internal task, no data of consequence to transform.

Compatibility Verify three things before committing: declared Laravel/PHP ranges, whether the migrations collide with existing tables of the same name (they will if a prior Spatie install was ever present), and whether the service provider registers cleanly under Octane or in a queued-job context where the auth user may be absent.

Sequencing

  1. Spike (2–3 days). Throwaway branch, real schema, real seeding, load-test the can() path with a representative permission count (say 200 permissions, 50 roles). Produce a query-count and latency number.
  2. Decision gate. Compare against Spatie on the same spike harness. Adopt this package only if it wins on a specific axis — simpler multi-tenant scoping, materially better performance, or a licensing constraint we cannot meet otherwise. "It looked lighter" is not a reason.
  3. Vendor and pin. Fork to an internal namespace or pin to an exact tag with a lockfile audit. Add a composer audit step to CI.
  4. Pilot. One bounded, internal-facing service. Not customer-facing, not on the revenue path.
  5. Generalize only after the pilot survives a full quarter without upstream issues.

Operational Impact

Maintenance Budget for fork maintenance, not for "using a package." The realistic steady state is: we own a vendored copy and rebase rarely. Assign a named owner. The cost is low but non-zero, and it must be visible in planning or it becomes nobody's job until a Laravel major upgrade breaks it.

Support No commercial support, no SLA, no guaranteed response on issues. Internal engineers are the support tier. Documentation quality is unknown and likely thin; assume the source is the documentation. This is acceptable for a small internal tool and unacceptable for a system with an external audit or compliance obligation attached to its access control.

Scaling Two axes. Data volume: role/permission tables are small and stable, so row growth is a non-issue. Check volume: authorization runs on nearly every request, so caching behavior dominates. If the package queries per check, p99 latency will degrade as permission count grows and can push you into a cache layer you build and own anyway. Multi-tenancy is the other cliff — retrofitting tenant scoping onto a global-role model means a schema change plus a full audit of every gate.

Failure modes

  • Silent denial. Misconfigured or uncached state causes can() to return false, the UI hides a control, and no error is raised. Instrument authorization denials and alert on anomaly, or this is invisible until a customer reports a missing button.
  • Silent grant. Worse and less likely: a stale cache retains a revoked permission past the point where the user should have lost it.
  • Cache invalidation gaps. Role changes applied via seeder, direct DB edit, or admin UI that bypasses the package's model events leave the cache inconsistent.
  • Upstream abandonment. No release for a Laravel major cycle; we patch locally under time pressure.
  • Package-name incident. An engineer adds the wrong adjacent package; the lockfile diff is the only place this surfaces.

Ramp-up For an engineer who knows Laravel authorization, a day. For an engineer who knows Spatie, add a day of unlearning — this is the hidden cost and the one most likely to produce a subtle bug, because the surface vocabulary is identical while the semantics are not. Onboarding documentation must be internal, written by us, and must include the explicit "this is not Spatie" warning at the top.

Recommendation. A TPM should not standardize on this package. The 47 stars and zero dependents are not a maturity signal to be overcome by due diligence; they are the due diligence result. Permit it only for a bounded internal tool where a fork is an acceptable endgame, and only after the spike returns concrete performance numbers. For anything on the revenue path or under audit, take the boring option and reallocate the risk budget elsewhere.

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.
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle
adachsoft/api-version-bundle
elsayed85/laravel-api-exceptions
ouhssini/laravel-demo-mode
daworks/ncloud-outbound-mailer-driver
gp247/cms
ignibyte/aic-gates
nexa-merchant/blog
novasa/laravel-language-center
opencage/geocode
adolfoholzer/parameters
livenetworks/ln-starter
cgv/localized-resource