mpociot/teamwork
Teamwork is a Laravel package for adding teams, members, and user invitations to your app. Attach teams to any model with a simple trait, manage memberships and roles, and send email invitations with acceptance flows—without reinventing team management.
Architecture fit
mpociot/teamwork is a thin, opinionated Eloquent package: it ships teams, team_members (pivot-ish) and invitations migrations, a Team model, an Invitation model, a HasTeams trait applied to the host User, and a small service/facade for invite → accept → attach flows.spatie/laravel-permission covers the roles/permissions axis that Teamwork deliberately leaves to you. Any evaluation has to justify building on a narrow package instead of a maintained first-party or de-facto-standard one.role column check, which means the "team" concept is split across two libraries with no shared contract.Integration feasibility
composer require + vendor:publish + trait on User. A day of work end to end, including invitations.illuminate/* range, the service provider and facade predate the modern package-discovery conventions in some spots, and PHP 8 will surface signature and nullability issues in the trait and models. The realistic path is vendoring/forking, not requiring.Technical risk
team_members/invitations, not just a code swap.$fillable before exposing any team-management endpoint.Key questions
Membership model already exist in the codebase, and are we about to create a second source of truth?Stack fit
App\User and no existing team concept. In that context it is genuinely faster than writing it.Organization/Membership model. Two team models in one schema is a permanent reconciliation cost.Migration path
acme/teamwork) with the upstream MIT license retained, bump illuminate/* constraints, add PHP 8 type fixes, and treat the fork as first-party code. Budget 3–5 engineer-days for the upgrade plus test coverage.Compatibility
composer.json against our target versions before anything else — this single check usually decides the approach.onDelete('cascade').User model: any conflicting methods (teams(), ownedTeams(), currentTeam()) will collide silently.Sequencing
User.Maintenance
composer audit.Support
Scaling
team_members.user_id, team_members.team_id (composite unique on the pair), and invitations.token / invitations.email.$user->teams inside a loop will fan out. Enforce eager loading in code review or add a query scope.Failure modes
teams table already exists or is later introduced by another package/feature — the migration will fail loudly or, worse, silently adopt the wrong table.Ramp-up
How can I help you explore Laravel packages today?