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

Dynamic Role Bundle Laravel Package

ticketpark/dynamic-role-bundle

A Symfony bundle that adds support for dynamic roles, letting applications define and manage security roles at runtime instead of hardcoding them in configuration. Useful when roles need to be created, stored, or changed without redeploying.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture fit

  • The package is a Symfony bundle, not a Laravel package. It wires into Symfony's DI container, config tree, and — critically — the Symfony Security component for role resolution.
  • Laravel has no Symfony Security component. Authorization runs through Gate, Policy, and Illuminate\Auth. There is no seam where this bundle plugs in.
  • The genuinely reusable asset is the conceptual model plus DBAL schema: dynamic roles persisted in a table, resolved per-user at authorization time, rather than hardcoded in config. That idea ports cleanly; the code does not.

Integration feasibility

  • Low as an integration, moderate as a reimplementation. Expect to port rather than install:
    • Role/assignment schema (roles table, user-role join).
    • A role resolver service bound in a Laravel service provider.
    • Gate integration via Gate::before or a User::can() override.
    • Cache layer with explicit invalidation on role change.
  • Realistic effort: 1–2 engineer-weeks for a competent PHP dev, assuming no multi-tenancy or hierarchy requirements.

Technical risk

  • Abandoned: last release 2017-12-01 (~8 years), 0 stars, 0 dependents, no community validation. This is auth-adjacent code with no security response capability.
  • Era mismatch: Symfony 3.x / PHP 7.0–7.1 constraints. Doctrine DBAL 2.x APIs (e.g. fetchAssoc) were removed in DBAL 3. Modern PHP 8 typed properties and enums will collide.
  • Unvalidated in production: zero dependents means zero field evidence. Correctness and edge-case behavior (role removal, inheritance, caching) are unknown.
  • Authorization code failing silently is a privilege escalation class of bug, not a cosmetic one. The risk profile is disproportionate to the package's apparent simplicity.

Key questions

  • Does the schema support role hierarchy/inheritance, or flat assignment only?
  • What is the per-request query pattern — is there any caching layer, or a DB hit per isGranted() call?
  • Is there a cache invalidation hook, or do role changes require manual cache clears?
  • Multi-tenancy: can roles be scoped per tenant/org, or is the model global?
  • Who owns the fork internally, and what is the CVE-response commitment?

Integration Approach

Stack fit

  • Poor. No service provider, no publishable config, no facade, no Laravel conventions whatsoever.
  • Doctrine DBAL is installable alongside Eloquent but introduces a second DB abstraction layer — a maintenance and cognitive tax with no payoff here.
  • The Symfony bundle's value (DI autowiring, security voter registration) is entirely in machinery Laravel doesn't have.

Migration path Treat the repository as a reference implementation, not a dependency:

  1. Extract the schema and role-resolution semantics from the source.
  2. Reimplement natively: migration + Eloquent model, RoleResolver service, service provider binding.
  3. Integrate at the Gate layer (Gate::before for super-admin, policy checks for granular abilities).
  4. Add Cache-backed role sets with tag-based invalidation.
  5. Do not vendor the bundle or add it to composer.json.

Compatibility

  • Symfony DI config format (XML/YAML), PHP version floor, and DBAL 2 → 3/4 API changes all require rewriting.
  • Effectively a clean-room port. Budget accordingly and don't present this to stakeholders as "reuse."

Sequencing

  1. Schema + migration (roles, assignments, indexes).
  2. Resolver + repository with unit tests (this is where correctness lives).
  3. Gate/Auth integration and fail-closed behavior.
  4. Cache + invalidation on assignment change.
  5. Admin surface for role assignment (API or UI).
  6. Backfill/dual-write if replacing existing role storage.
  7. Deprecate and remove the legacy path.

Alternative worth evaluating first: spatie/laravel-permission covers the same domain, is Laravel-native, actively maintained, and has broad production adoption. Unless this package's schema encodes something specific you need, the correct TPM recommendation is to adopt the mature package and skip the port entirely.

Operational Impact

Maintenance

  • Zero upstream maintenance. Fork-and-own: your team absorbs all bug fixes, PHP/Symfony version bumps, and security patches.
  • No maintainer to escalate to, no release cadence to track, no dependency-update automation value.

Support

  • No issue triage, no security policy, no documentation beyond a README from 2017.
  • Internal documentation and an explicit ownership assignment are mandatory before any production use.

Scaling

  • Dynamic role resolution typically means a DB read on the authorization path. Uncached, this becomes a per-request bottleneck and a latency amplifier on every guarded endpoint.
  • Required mitigations: request-scoped memoization, per-user role-set caching (Redis), and cache warming for high-traffic users.
  • Watch for N+1 patterns when listing users with roles.

Failure modes

  • DB unavailable → authorization must fail closed. Verify this explicitly; a permissive fallback is a critical vulnerability.
  • Stale cache after role revocation → the highest-severity failure: a user retains access after removal. Invalidation must be synchronous and reliable.
  • Cache stampede on cold start or mass invalidation.
  • Schema drift with no migration tooling from upstream.
  • Silent role-removal bugs leaving orphaned grants in the join table.

Ramp-up

  • Small code surface, but reading it requires PHP/Symfony fluency plus security-domain literacy — a narrower hiring profile than typical Laravel work.
  • Estimate: 1 engineer, 1–2 weeks to reimplement, plus a named owner for ongoing stewardship.

Bottom line for the TPM: this is not a leverageable dependency. It is, at best, a design reference for a capability you must build or buy. Given 0 stars, 0 dependents, 8 years of abandonment, and an auth-adjacent blast radius, the defensible recommendation is buy/adopt a maintained Laravel-native alternative unless a specific requirement forces a bespoke implementation.

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.
snowsoft/faker
meditationsteps/blogetc
animalyoung/laravel-influxdb
onix-solutions/sms-telera
lonely-lights/prosetta
oxygen/data
oxygen/core
jengo/base
xiloryx/log-collector
a21ns1g4ts/filament-stripe
la-php/laravel-admin
artisan-build/community-prompts
vleroy/smart
ayles-software/laravel-australian-public-holidays
cboxdk/laravel-id-spatie
cboxdk/laravel-id-billing
cboxdk/laravel-id-billing-bridge
simple-as-fuck/php-performance-log
hsluv/hsluv
seampact/codegen