PHPackages                             squareetlabs/laravel-teams-permissions - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. squareetlabs/laravel-teams-permissions

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

squareetlabs/laravel-teams-permissions
======================================

A comprehensive Laravel package for advanced team-based permission management in multi-tenant applications. Features RBAC, granular permissions, entity-specific abilities, global groups, audit logging, REST API, and seamless Laravel integration.

v1.0.1(5mo ago)02MITPHPPHP ^8.1

Since Dec 2Pushed 5mo agoCompare

[ Source](https://github.com/squareetlabs/LaravelTeamsPermissions)[ Packagist](https://packagist.org/packages/squareetlabs/laravel-teams-permissions)[ RSS](/packages/squareetlabs-laravel-teams-permissions/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (13)Versions (3)Used By (0)

Squareetlabs/LaravelTeamsPermissions
====================================

[](#squareetlabslaravelteamspermissions)

[![Latest Stable Version](https://camo.githubusercontent.com/70c311577eaeba47f6e58fa9c3de45cf1bb9d908685d2af0d52f124a92c84299/68747470733a2f2f706f7365722e707567782e6f72672f73717561726565746c6162732f6c61726176656c2d7465616d732d7065726d697373696f6e732f762f737461626c65)](https://packagist.org/packages/squareetlabs/laravel-teams-permissions)[![PHP Version Require](https://camo.githubusercontent.com/daa44b41292e0e798534b46193ef8393c7aae07bc44b7f04bd16df2587dad1bb/68747470733a2f2f706f7365722e707567782e6f72672f73717561726565746c6162732f6c61726176656c2d7465616d732d7065726d697373696f6e732f726571756972652f706870)](https://packagist.org/packages/squareetlabs/laravel-teams-permissions)[![License](https://camo.githubusercontent.com/6d0ea6f414b353d136ae2b052b29d4500fcbd638272e3018327974623d5fac0b/68747470733a2f2f706f7365722e707567782e6f72672f73717561726565746c6162732f6c61726176656c2d7465616d732d7065726d697373696f6e732f6c6963656e7365)](https://packagist.org/packages/squareetlabs/laravel-teams-permissions)

A comprehensive Laravel package designed for advanced team-based permission management in multi-tenant applications based on \[[Jurager/Teams](https://github.com/Jurager/teams)\]. This package provides a flexible and powerful system for organizing users into teams, assigning granular permissions through roles and groups, and managing entity-specific access controls.

**Core Functionality:**

- **Team Management**: Create and manage teams with owners and members. Each team operates as an independent workspace with its own set of roles, permissions, and members.
- **Role-Based Access Control (RBAC)**: Define custom roles for each team with specific permission sets. Roles can be assigned to users within a team, providing a flexible way to manage access levels. Team owners automatically have full access to all permissions.
- **Permission System**: Implement fine-grained permissions using a code-based system (e.g., `posts.create`, `users.edit`). Permissions are global entities that can be assigned to roles and groups across multiple teams. Supports wildcard permissions for flexible access patterns.
- **Group Management**: Organize users into groups within teams or globally. Groups can have their own permission sets, and permissions assigned to a group take precedence over individual user permissions within a team. This allows for efficient permission management when multiple users need the same access level.
- **Global Groups**: Create groups without team association to grant users access across all teams with the group's permissions. Perfect for scenarios like support teams, administrators, or auditors who need consistent access across multiple teams without being individually added to each one.
- **Entity-Specific Abilities**: Grant or deny permissions for specific model instances (e.g., allowing a user to edit a particular post but not others). This provides the most granular level of access control, enabling fine-tuned permissions for individual resources.
- **Multi-Tenant Support**: Built from the ground up for multi-tenant applications where each team represents a tenant. Teams are completely isolated, ensuring data security and access control between different tenants.
- **Caching &amp; Performance**: Optional intelligent caching system to optimize permission checks, reducing database queries and improving application performance.
- **Audit Logging**: Optional comprehensive audit trail that logs all team-related actions including role assignments, permission changes, and member additions/removals.
- **REST API**: Optional complete REST API for team management, enabling frontend applications and third-party integrations to manage teams programmatically.
- **Laravel Integration**: Seamlessly integrates with Laravel's built-in authorization system, including Policies, Blade directives, and middleware for route protection.

Key Features
------------

[](#key-features)

- ✅ **Team Management**: Create and manage teams with owners and members
- ✅ **Roles &amp; Permissions**: Flexible role system with granular permissions
- ✅ **Groups**: Organize users into groups with shared permissions
- ✅ **Abilities**: Entity-specific permissions for individual models
- ✅ **Smart Caching**: Caching system to optimize permission checks
- ✅ **Audit Logging**: Complete action logging for teams (optional)
- ✅ **REST API**: Complete API for team management (optional)
- ✅ **Blade Directives**: Blade directives for permission checks in views
- ✅ **Policies**: Integration with Laravel's Policy system
- ✅ **Rate Limiting**: Protection against invitation spam
- ✅ **Middleware**: Middleware for route protection
- ✅ **Artisan Commands**: CLI tools for management

Requirements
------------

[](#requirements)

- PHP &gt;= 8.1
- Laravel 8.x, 9.x, 10.x, 11.x or 12.x

Installation
------------

[](#installation)

### 1. Install the Package

[](#1-install-the-package)

```
composer require squareetlabs/laravel-teams-permissions
```

### 2. Publish Configuration and Migrations

[](#2-publish-configuration-and-migrations)

```
php artisan vendor:publish --provider="Squareetlabs\LaravelTeamsPermissions\TeamsServiceProvider"
```

This will publish:

- `config/teams.php` - Configuration file
- Database migrations

### 3. Configure the User Model

[](#3-configure-the-user-model)

Add the `HasTeams` trait to your `User` model:

```
