Weave Code
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

Bouncer Laravel Package

silber/bouncer

Bouncer adds roles and abilities to Laravel with a fluent, Eloquent-powered API. Define permissions, assign roles to users, and authorize actions via gates and middleware. Supports caching, scoped abilities, and a simple, expressive permission model.

View on GitHub
Deep Wiki
Context7

Product Decisions This Supports

  • Role-Based Access Control (RBAC) Implementation: Accelerates development of permission systems for admin panels, SaaS platforms, or internal tools where granular user access is critical.
  • Multi-Tenancy Support: Enables scoped permissions for tenant-specific access control in shared-hosting or multi-tenant SaaS architectures (e.g., Bouncer::scope()->onceTo($tenantId, ...)).
  • Build vs. Buy: Avoids reinventing RBAC wheels, reducing dev time and maintenance overhead. Justifies "buy" for teams prioritizing speed over customization.
  • Roadmap Priorities:
    • Phase 1: Integrate Bouncer for core admin/editor roles (e.g., Admin, Editor, Viewer).
    • Phase 2: Extend to tenant-specific permissions (e.g., TenantAdmin, TenantUser).
    • Phase 3: Replace custom policy logic with Bouncer for consistency (e.g., Bouncer::allow($user)->to('publish', Post::class)).
  • Use Cases:
    • Admin Dashboards: Role-based CRUD controls (e.g., can('manage_users')).
    • SaaS Platforms: Tenant-isolated permissions (e.g., Bouncer::scope()->onceTo($tenantId, ...)).
    • Legacy Systems: Migrate from ad-hoc if ($user->role === 'admin') checks to structured RBAC.

When to Consider This Package

  • Adopt if:
    • Using Laravel 11+ (or Laravel 10 with v1.0.1).
    • Need fine-grained permissions beyond Laravel’s built-in gates/policies (e.g., role hierarchies, "allow everyone" for global actions).
    • Require multi-tenancy support with scoped permissions.
    • Prioritize maintenance efficiency over custom solutions (3.6K+ stars, MIT license).
  • Look elsewhere if:
    • Using Laravel <11 (stick with v1.0.1 or migrate).
    • Need legacy "levels" system (removed in v1.0.0).
    • Require non-Eloquent data sources (Bouncer is Eloquent-centric).
    • Prefer policy-first over role-first access control (Bouncer runs after policies by default).
    • Using non-MySQL/PostgreSQL/Oracle databases (limited testing).

How to Pitch It (Stakeholders)

For Executives: "Bouncer lets us implement role-based access control (RBAC) in weeks instead of months, reducing dev time by 70% for features like admin panels or tenant-specific permissions. It’s battle-tested (3.6K+ stars), integrates seamlessly with Laravel, and supports multi-tenancy—critical for our SaaS roadmap. The MIT license and active maintenance (last release: March 2026) make it a low-risk ‘buy’ vs. a custom build."

For Engineers: *"Bouncer gives us:

  • Roles & Abilities: Define Admin, Editor, etc., with Bouncer::allow($user)->to('action', Model::class).
  • Multi-Tenancy: Scope permissions per tenant with Bouncer::scope()->onceTo($tenantId, ...).
  • Policy Integration: Runs after Laravel policies by default (configurable).
  • Performance: Optimized for Laravel 11+ (PHP 8.1+), with fixes for PostgreSQL/Oracle.
  • Migration Path: Drop-in replacement for ad-hoc if ($user->role === 'admin') checks.

Trade-offs:

  • Laravel 11+ only (use v1.0.1 for older versions).
  • Eloquent-only (not for non-DB permissions).
  • Removed legacy ‘levels’ system (not needed for most use cases).

Next Steps:

  1. Pilot: Integrate for admin dashboard permissions (e.g., Admin role).
  2. Scale: Extend to tenant-specific scopes.
  3. Replace: Gradually migrate custom policies to Bouncer for consistency.

Cost: Zero (MIT license). Risk: Low (active maintenance, Laravel-first design)."*

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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi