Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Laravel
  3. Defender

Defender

MITPHPv0.12.0

An Access Control List (ACL) solution for Laravel applications, providing roles and permissions management with security and usability in mind.

GitHubGitHub
437 stars93 forks0 contributors

What is Defender?

Defender is an Access Control List (ACL) solution for Laravel applications that manages roles and permissions. It provides a secure way to control user access to different parts of an application, integrating seamlessly with Laravel's authentication system. The package includes features like middleware for route protection, Blade directives for view-level control, and support for temporary permissions.

Target Audience

Laravel developers building applications that require fine-grained user access control, such as admin panels, multi-tenant systems, or any app with role-based permissions.

Value Proposition

Developers choose Defender for its deep integration with Laravel, comprehensive feature set including temporary permissions and JavaScript helpers, and its focus on security without sacrificing usability. It's a dedicated ACL package that simplifies complex permission structures.

Overview

Roles & Permissions for Laravel

Use Cases

Best For

  • Adding role-based access control to Laravel admin panels
  • Securing API endpoints with permission-based middleware
  • Implementing temporary user permissions for trial features
  • Managing multi-level user roles in SaaS applications
  • Conditionally showing UI elements based on user permissions
  • Extending Laravel's built-in authentication with ACL capabilities

Not Ideal For

  • Applications using Laravel's multi-auth or multiple authentication guards
  • Projects needing a pre-built admin UI for managing roles and permissions out of the box
  • Systems requiring complex hierarchical roles or conditional permission inheritance beyond flat structures
  • Teams wanting a zero-configuration drop-in package with full auto-discovery and minimal setup

Pros & Cons

Pros

Deep Laravel Integration

Defender seamlessly integrates with Laravel's ecosystem, offering built-in middleware like 'needsPermission' for route protection, Blade directives such as @shield for view-level control, and artisan commands for role and permission management, as detailed in the Usage section.

Temporary Permissions

It uniquely supports time-based access control with automatic expiration, allowing permissions to be granted or revoked for specific durations using Carbon, ideal for features like trial access, as explained in the Temporary Permissions section.

Frontend JavaScript Helper

Defender provides a JavaScript helper that injects user permissions and roles into the frontend via Defender::javascript()->render(), enabling client-side access control without additional API calls, highlighted in the JavaScript Helper section.

Custom Model Flexibility

It allows extending and using custom Role and Permission models, making it adaptable to different database drivers like MongoDB, as demonstrated in the Using custom Role and Permission models section with examples for non-SQL databases.

Cons

No Multi-Auth Support

The README explicitly states Defender is not compatible with multi-auth, limiting its use in applications with multiple authentication guards or complex user types, a significant drawback for modern Laravel setups.

Manual Configuration Overhead

Setup requires publishing configuration files and migrations, registering service providers for Laravel <5.5, and manually adding middleware to the Kernel, which adds complexity compared to more modern auto-discovered packages.

Potential Maintenance Risks

The project is actively looking for maintainers and contributors, as noted in the Contribution welcome section, which could lead to slower updates, fewer features, or compatibility issues with future Laravel versions.

Frequently Asked Questions

Quick Stats

Stars437
Forks93
Contributors0
Open Issues22
Last commit2 years ago
CreatedSince 2015

Tags

#rbac#authentication#laravel#acl#authorization#security#access-control#laravel-package#php#middleware

Built With

C
Composer
P
PHP
L
Laravel

Included in

Laravel13.0k
Auto-fetched 8 hours ago

Related Projects

LiveWireLiveWire

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

Stars23,567
Forks1,745
Last commit11 hours ago
Debug BarDebug Bar

Debugbar for Laravel (Integrates PHP Debug Bar)

Stars19,277
Forks1,613
Last commit2 days ago
IDE HelperIDE Helper

IDE Helper for Laravel

Stars14,960
Forks1,194
Last commit18 days ago
Intervention ImageIntervention Image

PHP Image Processing

Stars14,369
Forks1,494
Last commit10 days 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