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

sourceboat/laravel-static-permission

Laravel Static Permission lets you define permissions in code or configuration instead of database tables. Check access with familiar Gate, middleware, and Blade helpers—ideal for apps with fixed, predictable authorization rules and no permission-table overhead.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Verdict up front: the package addresses a legitimate architectural pattern — permissions as code rather than database rows — but the adoption signals are effectively absent (0 stars, 0 dependents, score 0). Treat this as a pattern reference first and a dependency second. The core capability is small enough (likely a config/class registry plus a Gate integration) that building it in-house is a credible alternative to taking a dependency on an unmaintained, unvalidated authorization package.

Architecture fit

  • Static permission definitions suit systems where the set of capabilities is coupled to code: every permission maps to a route, policy, or UI affordance that ships in the same deploy. This eliminates a classic failure mode of DB-backed RBAC — permission rows drifting from the code that checks them.
  • Poor fit where non-engineers must create roles or grant permissions at runtime (customer-configurable roles, tenant-defined scopes, admin panels). Static definitions make that a code change and a deploy.
  • Ambiguity to resolve early: does the package define only the catalog of permissions/roles, or does it also resolve which users hold which roles? If role assignment is also static, it is only viable for fixed-role apps; if assignment is dynamic, it still needs a storage and migration story, and the package is a thinner slice than it first appears.
  • The decisive architectural question is whether it plugs into Laravel's native Gate/Policy layer. If it does, controllers, Blade @can, middleware, and policies are unchanged and the package is swappable. If it introduces its own authorization API, it becomes a sticky dependency on an unmaintained library inside a security-critical path.

Integration feasibility

  • Likely a composer require with Laravel package auto-discovery, a publishable config file, and permission/role classes in app/. Low integration effort for a spike; realistically a day or two to validate.
  • Compatibility surface to verify: Laravel and PHP version constraints against the target stack (L5–L8-era packages frequently break on Laravel 10/11), PHP 8.x deprecations, and whether tests run on modern matrices.
  • No dependents means no field evidence of behavior under multi-guard setups, Sanctum/API-token contexts, queued jobs and console commands (where there is no authenticated user), or Octane long-running workers.

Technical risk

  • Security-critical, low-scrutiny dependency. Authorization bugs are silent and high-impact. An unmaintained package in this layer is a standing risk; with zero dependents there is no evidence of production hardening, no community CVE watching, and no third party to notice regressions.
  • Bus factor. Published by an agency (sourceboat) as a likely byproduct of client work; support and release cadence are unproven. Assume you may own the code.
  • Mitigating factor: the likely code volume is small. Forking or reimplementing is cheap, which caps the downside — provided the API is thin and standard-Gate-based.
  • Upgrade drag. A pinned abandoned package can block Laravel major upgrades at the least convenient time.

Key questions for the maintainers / spike

  1. Does it integrate via Laravel Gate/Policy (and Gate::before), or a bespoke authorization API?
  2. Are roles statically fixed, or are user→role assignments persisted? If persisted, what schema and migration path?
  3. Supported Laravel/PHP versions, test coverage, CI status, and date of last release/commit?
  4. License terms and willingness to accept PRs or transfer ownership?
  5. Multi-guard, multi-tenant/teams, and wildcard/* permission support?
  6. Behavior under config:cache, Octane, and queued jobs?
  7. Is there a security disclosure process?

Integration Approach

Stack fit

  • Best fit: Laravel monolith or small service, permissions tightly bound to code paths, roles that are genuinely fixed (admin/member/viewer), and a team that deploys frequently.
  • Weak fit: multi-tenant SaaS with per-tenant roles, or any product where an admin UI for roles is on the roadmap.
  • Neutral: API-only services using Sanctum — workable if it hooks into Gate and handles unauthenticated/queued contexts gracefully.

Migration path (from spatie/laravel-permission or custom tables)

  1. Inventory first. Enumerate every permission string currently checked (@can, Gate::allows, middleware, policies). This is the expensive step, not the library swap.
  2. Codify the catalog as enums/constants so permission names are compile-checked and typo-proof — a real gain over string literals in DB rows.
  3. Preserve the check sites. If integration is Gate-based, leave controllers/views untouched; swap only the provider behind Gate.
  4. Handle assignments. If user→role data must survive, keep the existing pivot table and add a thin resolver, or map existing roles to the static catalog with a one-off migration/backfill.
  5. Dual-run and diff. In staging, log decisions from both old and new authorization paths and reconcile mismatches before cutover. Remove the old package and tables in a follow-up deploy.

Compatibility and sequencing

  • Spike on a branch: install, define one role and three permissions, wire a policy, verify @can, middleware, API guard, queue job, and config:cache behavior.
  • Gate the decision on the spike plus a read of the source (likely under an hour). If the package is under ~500 LOC and Gate-native, fork-and-vendor it under your namespace rather than depending on the upstream — this removes abandonment risk at near-zero cost.
  • Sequence: inventory → spike → fork/vendor if adopted → catalog codification → dual-run verification → cutover → decommission old tables.

Operational Impact

Maintenance

  • Low runtime maintenance, higher ownership maintenance. No migrations, no seeders, no cache warmup, no permission drift between environments — deploys become the single source of truth for authorization changes.
  • Assume you will maintain the fork. Budget a small recurring cost for Laravel major-version compatibility checks, or accept a pinned version until a rewrite.

Support

  • Effectively none: no community, no dependents, no issue-tracker triage velocity to rely on. Escalation path is "read the source." This is acceptable for a fork you control, unacceptable as a black-box dependency in a regulated or audited environment.

Scaling

  • A genuine strength. Permission checks resolve from in-memory definitions — no DB round-trip, no Redis cache, no cache-invalidation bugs after deploys. Behaves well under Octane and horizontal scaling, and removes a shared-state dependency from the authorization hot path.

Failure modes

  • Deploy/permission skew: a removed or renamed permission ships and a route starts returning 403 in production. Mitigate with enum-based constants (compile-time safety) and a deploy-time assertion that every referenced permission exists in the catalog.
  • Silent 403s: authorization failures are indistinguishable from auth bugs in logs. Require structured logging of denied decisions with the permission name during rollout.
  • Config cache staleness: definitions cached at config:cache time; a class-based registry is safer than config arrays here.
  • Context gaps: queued jobs, console commands, and webhooks have no authenticated user — verify the package degrades to deny rather than throwing.
  • No runtime admin path: urgent production permission grants require a deploy; document the hotfix/rollback runbook. Git becomes your audit trail — acceptable, and arguably better, if your compliance model accepts code review as the change-control mechanism.

Ramp-up

  • Small for Laravel-fluent engineers: the mental model (permissions as constants, roles as code) is simpler than DB-backed RBAC, and existing @can knowledge transfers if Gate-native.
  • Documentation is almost certainly thin; onboarding cost is "read the source" — another argument for forking into a repo your team owns and annotating.

Recommendation: conditionally viable for small, code-deployed permission models where the team accepts ownership of a fork. Do not adopt as a black-box dependency for a security-critical, long-lived product. Validate Gate integration and role-assignment semantics in a one-day spike; if those hold, vendor the code under your own namespace and move on.

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