PHPackages                             labrodev/laravel-team - 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. [Payment Processing](/categories/payments)
4. /
5. labrodev/laravel-team

ActiveLibrary[Payment Processing](/categories/payments)

labrodev/laravel-team
=====================

Teams, memberships, invitations, roles and plan/billing mechanics for Laravel SaaS applications — the Labrodev multi-tenancy core.

v1.0.0(yesterday)00MITPHP ^8.4

Since Jul 22Compare

[ Source](https://github.com/labrodev/laravel-team)[ Packagist](https://packagist.org/packages/labrodev/laravel-team)[ Docs](https://github.com/labrodev/laravel-team)[ RSS](/packages/labrodev-laravel-team/feed)WikiDiscussions Synced today

READMEChangelogDependencies (9)Versions (2)Used By (0)

labrodev/laravel-team
=====================

[](#labrodevlaravel-team)

Teams, memberships, invitations, roles and plan/billing mechanics for Laravel SaaS applications — the Labrodev multi-tenancy core.

The package owns the **mechanism**: teams with owner/admin/member roles, invitation flow, a per-team subscription-plan **caps snapshot** (`-1` = unlimited), plan checkout / swap / cancel orchestration behind a gateway contract, and a `team` morph alias so polymorphic rows (e.g. a billing provider's `billable_type`) never depend on class FQCNs.

The application owns the **policy**: its plan enum (cases, pricing, cap keys), the rules that consume caps, and all UI. Payment providers are adapter packages implementing the `BillingClient` contract — see `labrodev/laravel-team-paddle`.

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

[](#installation)

```
composer require labrodev/laravel-team

php artisan vendor:publish --tag=team-config
php artisan vendor:publish --tag=team-migrations
php artisan migrate
```

Wiring the application
----------------------

[](#wiring-the-application)

### 1. User model

[](#1-user-model)

```
use Labrodev\Team\Concerns\HasTeams;
use Labrodev\Team\Contracts\TeamMember;

final class User extends Authenticatable implements TeamMember
{
    use HasTeams;
}
```

The `users` table needs a nullable `current_team_id` column.

### 2. Plan enum

[](#2-plan-enum)

Define a string-backed enum implementing `Labrodev\Team\Contracts\PlanContract` and point `config/team.php` at it:

```
enum Plan: string implements PlanContract
{
    case Free = 'free';
    case Pro = 'pro';

    public function label(): string { /* ... */ }
    public function isPaid(): bool { /* ... */ }

    /** @return array */
    public function caps(): array
    {
        return match ($this) {
            self::Free => ['monitors' => 3, 'seats' => 1],
            self::Pro => ['monitors' => -1, 'seats' => -1],
        };
    }
}
```

```
// config/team.php
'user_model' => App\Models\User::class,
'plan_enum' => App\Enums\Plan::class,
'free_plan' => 'free',
```

`TeamCreate` snapshots the free plan's `caps()` onto the team's `subscription_plans` row, so later plan-definition changes never retro-affect existing teams. Read caps via `$team->subscriptionPlan->cap('monitors')`.

Applications that prefer typed cap columns can add them in their own migration on top of the published `subscription_plans` table and bind their own snapshot logic.

### 3. Exception rendering

[](#3-exception-rendering)

Package exceptions never construct a `ValidationException`. They implement one of two contracts; register render mappings once (e.g. `bootstrap/app.php`):

```
use Labrodev\Team\Contracts\ProvidesFieldError;
use Labrodev\Team\Contracts\ProvidesFlashError;

$exceptions->render(fn (ProvidesFieldError $e, Request $r) => $r->expectsJson()
    ? response()->json(['message' => $e->userMessage(), 'errors' => [$e->field() => [$e->userMessage()]]], 422)
    : redirect()->back()->withErrors([$e->field() => $e->userMessage()]));

$exceptions->render(fn (ProvidesFlashError $e, Request $r) => $r->expectsJson()
    ? response()->json(['message' => $e->userMessage()], 422)
    : redirect()->back()); // + your flash-toast mechanism
```

### 4. Billing gateway

[](#4-billing-gateway)

Bind an adapter implementing `Labrodev\Team\Contracts\BillingClient` (or install `labrodev/laravel-team-paddle`). With `team.sandbox` enabled, `StartPlanCheckout`bypasses the gateway and applies the target plan directly — for local development without a configured payment provider.

Usage
-----

[](#usage)

```
// Create a team (owner membership + plan snapshot + current-team switch, in one transaction)
$team = app(TeamCreate::class)(user: $user, teamCreateData: new TeamCreateData(name: 'Acme'));

// Invite / accept
app(TeamInvitationCreate::class)(team: $team, user: $inviter, teamInvitationCreateData: $data);
app(TeamInvitationAcceptedStatusUpdate::class)(teamInvitation: $invitation, user: $user);

// Plans
app(StartPlanCheckout::class)(team: $team, plan: Plan::Pro, customerName: ..., customerEmail: ..., returnUrl: ...);
```

Authorization: `TeamPolicy` ships with view/update/delete/member-management/`manageBilling`abilities driven by `TeamRole`/`TeamPermission`.

Testing
-------

[](#testing)

```
composer check   # pint --test, phpstan (level 7), rector --dry-run, pest
```

License
-------

[](#license)

MIT — see [LICENSE.md](LICENSE.md).

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

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

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/151143718?v=4)[Lashyn Petro ](/maintainers/labrodev)[@labrodev](https://github.com/labrodev)

---

Tags

laravelbillingsaasmulti-tenancyTeamsplanslabrodev

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/labrodev-laravel-team/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.3M347](/packages/psalm-plugin-laravel)[spatie/laravel-health

Monitor the health of a Laravel application

87512.0M177](/packages/spatie-laravel-health)[simplestats-io/laravel-client

Server-side analytics for Laravel that follows the full funnel from visit to registration to payment, attributed to the channel that drove it. Revenue, MRR, churn and ad-spend profit (ROAS/CAC) per channel. GDPR compliant, ad-blocker proof.

5022.6k](/packages/simplestats-io-laravel-client)[danestves/laravel-polar

A package to easily integrate your Laravel application with Polar.sh

8120.4k](/packages/danestves-laravel-polar)[api-platform/laravel

API Platform support for Laravel

58174.6k17](/packages/api-platform-laravel)[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.3k4](/packages/masterix21-laravel-licensing)

PHPackages © 2026

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