Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Laravel
  3. Bouncer

Bouncer

MITPHPv1.0.4

An elegant, framework-agnostic package for managing roles and abilities in Laravel using Eloquent models.

GitHubGitHub
3.6k stars335 forks0 contributors

What is Bouncer?

Bouncer is a Laravel package for managing roles and abilities using Eloquent models. It provides a fluent API to define and check permissions, integrating directly with Laravel's Gate for authorization. It solves the need for a clean, expressive way to handle user roles and capabilities without complex setup.

Target Audience

Laravel developers building applications that require fine-grained user permissions, role-based access control, or multi-tenant authorization systems.

Value Proposition

Developers choose Bouncer for its elegant syntax, seamless Eloquent integration, and flexibility in defining model-specific abilities and ownership rules. It reduces boilerplate while offering advanced features like forbidden abilities and multi-tenancy support.

Overview

Laravel Eloquent roles and abilities.

Use Cases

Best For

  • Implementing role-based access control in Laravel applications
  • Managing user permissions for specific model types or instances
  • Building multi-tenant apps with scoped roles and abilities
  • Adding ownership-based authorization (e.g., users editing their own posts)
  • Creating admin panels with granular permission management
  • Extending Laravel's Gate with fluent permission definitions

Not Ideal For

  • Projects not using Laravel's Eloquent ORM, as Bouncer's core functionality is tightly coupled to Eloquent models
  • Applications with extremely simple, static permission sets that don't justify the database and caching overhead
  • Teams that prefer to rely solely on Laravel's native policy classes and avoid third-party authorization packages
  • Real-time systems where permission changes must be reflected instantly without manual cache invalidation steps

Pros & Cons

Pros

Fluent, Expressive API

Offers a clean, chainable syntax for granting and checking permissions, reducing boilerplate code—evident in examples like Bouncer::allow($user)->to('edit', Post::class).

Deep Eloquent Integration

Seamlessly uses Eloquent models for roles and abilities, enabling easy relationships and queries, and works directly with Laravel's Gate and Blade directives.

Advanced Multi-tenancy Support

Includes built-in scoping features for multi-tenant apps, with customizable middleware and scope logic, as detailed in the multi-tenancy section.

Granular Ownership Rules

Allows defining ownership-based permissions with customizable attributes via ownedVia(), supporting complex scenarios like user-owned models without extra code.

Cons

Cache Management Burden

Enabling cross-request caching requires developers to manually refresh the cache with Bouncer::refresh() when permissions change, adding operational complexity and risk of stale data.

Non-Laravel Setup Complexity

Installation outside Laravel involves extra steps like setting up Eloquent Capsule and handling migrations manually, making it less straightforward than Laravel-native use.

Database Compatibility Issues

Migrations may fail on older database versions due to JSON column requirements, necessitating workarounds like modifying migrations, as mentioned in the FAQ.

Frequently Asked Questions

Quick Stats

Stars3,576
Forks335
Contributors0
Open Issues45
Last commit2 months ago
CreatedSince 2015

Tags

#eloquent#auth#laravel#acl#multitenancy#authorization#security#multi-tenancy#access-control#roles#php#permissions

Built With

P
PHP
L
Laravel
E
Eloquent

Included in

Laravel13.0k
Auto-fetched 1 day ago

Related Projects

LiveWireLiveWire

A full-stack framework for Laravel that takes the pain out of building dynamic UIs.

Stars23,529
Forks1,737
Last commit3 days ago
Debug BarDebug Bar

Debugbar for Laravel (Integrates PHP Debug Bar)

Stars19,230
Forks1,606
Last commit3 days ago
IDE HelperIDE Helper

IDE Helper for Laravel

Stars14,925
Forks1,190
Last commit1 month ago
Intervention ImageIntervention Image

PHP Image Processing

Stars14,344
Forks1,490
Last commit1 day ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub