PHPackages                             ibrostudio/laravel-teamable - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. ibrostudio/laravel-teamable

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ibrostudio/laravel-teamable
===========================

Add team properties to Eloquent models

v1.0.0(2y ago)040MITPHPPHP ^8.2

Since Jun 26Pushed 2y ago1 watchersCompare

[ Source](https://github.com/iBroStudio/laravel-teamable)[ Packagist](https://packagist.org/packages/ibrostudio/laravel-teamable)[ Docs](https://github.com/ibrostudio/laravel-teamable)[ RSS](/packages/ibrostudio-laravel-teamable/feed)WikiDiscussions main Synced today

READMEChangelog (1)Dependencies (15)Versions (2)Used By (0)

Laravel Teamable
================

[](#laravel-teamable)

Add team properties to Eloquent models.

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

[](#installation)

Install the package via composer:

```
composer require ibrostudio/laravel-teamable
```

Then run the installer:

```
php artisan data-repository:install
```

Usage
-----

[](#usage)

### Configuration

[](#configuration)

Add the trait `IBroStudio\Teamable\Concerns\IsTeamable` and the interface `\IBroStudio\Teamable\Contracts\Teamable` to the Eloquent model which must be a team.

**You can define many models as a team according to your needs.**

```
namespace App\Models;

use IBroStudio\Teamable\Concerns\IsTeamable;
use Illuminate\Database\Eloquent\Model;

class Company extends Model implements \IBroStudio\Teamable\Contracts\Teamable
{
    use IsTeamable;
}
```

Add the trait `IBroStudio\Teamable\Concerns\HasTeams` to the Eloquent model that will define member of the team.

```
namespace App\Models;

use IBroStudio\Teamable\Concerns\HasTeams;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasTeams;
}
```

### Creating team

[](#creating-team)

When you create a model that has the `IBroStudio\Teamable\Concerns\IsTeamable` trait, a `IBroStudio\Teamable\Models\Team` model is automatically created using the model's property defined in the `teamable.php` config file as the team name.

The default model property used is `name`. If your model does not have name, you can set another property to use in the `teamable.php` configuration file:

```
'model_name_attribute' => [
    'default' => 'name',
    Company::class => 'company_name'
],
```

You can disable automatic team creation by setting `auto.create` to false in the `teamable.php` configuration file.

```
$company = Company::create([
    'name' => 'iBroStudio',
]);

$company->team; // This give access to the team model through a MorphOne relationship
```

To add team to an existing model:

```
$company->createTeam();

$company->team; // This give access to the team model
```

### Add member to a team

[](#add-member-to-a-team)

```
$user->attachTeam($company->team);
```

A user can be a member of multiple teams and different team types:

```
$user->attachTeam($company_1->team);
$user->attachTeam($company_2->team);

$department = Department::create([
    'name' => 'Development',
]);
$user->attachTeam($department->team);
```

### Current team ID

[](#current-team-id)

For ease of use, a **current team ID** property is stored in a data repository for each team type.

When you add a member to a team, the value is set to that team's ID.

You can retrieve the value with the `getCurrentTeamId(TeamType $teamType)`method.

```
$user->getCurrentTeamId(TeamType::make(Company::class));
// or $user->getCurrentTeamId($company_1->team->type);

$user->getCurrentTeamId(TeamType::make(Department::class));
```

To change the current team ID, use the `switchToTeam` method:

```
$user->switchToTeam($company_2->team);
```

### Remove member from a team

[](#remove-member-from-a-team)

```
$user->detachTeam($company->team);
```

### Deleting team

[](#deleting-team)

Team model is automatically deleted when you delete the model that has the `IBroStudio\Teamable\Concerns\IsTeamable` trait.

You can disable automatic team deletion by setting `auto.delete` to false in the `teamable.php` configuration file.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 71.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

738d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3a456dae716df4be38cb7d5f02ca522a02ec37eda586ab0cae0f504516b7c1ef?d=identicon)[iBroStudio](/maintainers/iBroStudio)

---

Top Contributors

[![Yann-iBroStudio](https://avatars.githubusercontent.com/u/2676572?v=4)](https://github.com/Yann-iBroStudio "Yann-iBroStudio (10 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (1 commits)")

---

Tags

laraveliBroStudiolaravel-teamable

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/ibrostudio-laravel-teamable/health.svg)

```
[![Health](https://phpackages.com/badges/ibrostudio-laravel-teamable/health.svg)](https://phpackages.com/packages/ibrostudio-laravel-teamable)
```

###  Alternatives

[spatie/laravel-pdf

Create PDFs in Laravel apps

1.0k4.8M47](/packages/spatie-laravel-pdf)[codewithdennis/filament-select-tree

The multi-level select field enables you to make single selections from a predefined list of options that are organized into multiple levels or depths.

329530.5k29](/packages/codewithdennis-filament-select-tree)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)[worksome/exchange

Check Exchange Rates for any currency in Laravel.

124603.0k](/packages/worksome-exchange)[masterix21/laravel-licensing

Laravel licensing package with polymorphic assignment to any model, activation keys, expirations/renewals, and seat control via LicenseUsage. Supports offline verification with public-key–signed tokens, a CLI to generate/rotate/revoke keys, and an extensible architecture via config and contracts.

1563.1k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
