mediapress/bouncer
Role and permission-based authorization for Laravel. Bouncer lets you define abilities, assign roles and permissions, and check access anywhere in your app with clean, testable code—no bloated configuration or complex setup required.
Architecture fit. mediapress/bouncer is an Eloquent roles-and-abilities package in the lineage of josephsilber/bouncer: a service provider, published migrations (roles, abilities, permissions, assigned_roles, entity_abilities), a Bouncer trait for models, and integration with Laravel's Gate so that existing can() / @can / authorize() calls resolve role- and ability-based checks. Architecturally this is a comfortable fit for a conventional Laravel monolith or modular monolith that already leans on Gate/Policy. It is a poor fit if the application has standardized on Spatie permissions, custom policy registries, or an external authorization service — mixing two authorization sources is a well-known source of privilege-escalation bugs.
Integration feasibility. The material constraint is distribution: this is a Bitbucket-hosted fork with no star count reported and zero dependents, so there is effectively no ecosystem validation and likely no Packagist presence. Adoption therefore requires a Composer VCS repository entry, Bitbucket credentials in CI (app password or SSH key with expiry management), and a pinned commit or tag. Before any code is written, verify the fork's composer.json for PHP/Laravel version constraints, license, autoload namespace (Mediapress\Bouncer vs Silber\Bouncer), and whether migrations and config are publishable. Confirm whether it is a straight mirror of upstream or contains local patches — the diff against upstream is the single most important artifact for evaluating long-term risk.
Technical risk.
before/after callbacks, the auth guard, and cache stores; Laravel major-version upgrades can break these internals silently rather than loudly.Key questions.
josephsilber/bouncer? What is the exact diff, and why does it exist (Laravel version support, multi-tenancy, bug fixes)?mediaclickTR/mediapress internally, and what is the commitment to patch and security-fix?Bouncer::scope()), and does that match our tenancy model?Stack fit. Suitable for a Laravel application using Eloquent, the default Gate, and a relational database (MySQL/PostgreSQL). It assumes the standard users-style authenticatable model and a single authorization source of truth. If the platform is multi-tenant, confirm scope support before committing; if it is API-only with token guards, confirm that Gate integration behaves as expected across guards.
Migration path. The recommended path is not to adopt the fork directly. In order of preference: (1) use upstream josephsilber/bouncer if version constraints allow; (2) if the fork contains required patches, mirror it into an internal Git host (or Private Packagist/Satis) and maintain it as an internal package with named owners; (3) if the fork's value is narrow, implement authorization with native Gate/Policy plus a thin role table, eliminating the dependency entirely. Direct Bitbucket VCS references in composer.json should be treated as a stopgap, not a steady state.
Compatibility. Validate the fork's composer.json against the application's Laravel and PHP constraints, and check for migration-name collisions with any existing auth tables. Confirm the package's config file is publishable and that the cache store it uses (default Laravel cache) is the same one used in production. Check whether the fork targets the same major Laravel version as the rest of the dependency graph — a single stale constraint can block framework upgrades for the whole application.
Sequencing.
Maintenance. The fork becomes an internal dependency the moment it is adopted. Budget ongoing effort for upstream merges, Laravel upgrade compatibility, and security triage — work that is invisible until an upgrade deadline forces it. Without an assigned owner, this package will silently rot while remaining load-bearing for authorization.
Support. There is no vendor, no commercial support, and no community of dependents to lean on. Documentation is effectively whatever upstream provides, which may not match the fork's behavior. Incident response depends entirely on internal engineers reading the source.
Scaling. Authorization checks are frequent and often in hot paths. Bouncer's caching helps, but the operational burden shifts to cache invalidation: role changes must trigger Bouncer::refresh() (or equivalent) or users retain stale permissions until TTL expiry. In multi-tenant deployments, scope correctness becomes a scaling concern as the number of scopes grows; verify query patterns and indexes on the assignment and entity tables under realistic tenant counts.
Failure modes.
before callback conflicts with existing global authorization logic → silent policy bypass.Ramp-up. Engineers familiar with upstream Bouncer transfer quickly; engineers who know Spatie or native policies face a modest learning curve around the allow/assign/scope API and the cache model. Plan for a short internal knowledge session and an authorization-matrix test suite as the durable onboarding artifact — the tests, not the docs, will be the reliable specification.
How can I help you explore Laravel packages today?