Associate users with teams, roles, permissions, and invitations in Laravel.
roundly-consulting/teams-for-laravel is a Laravel package for associate users with teams, roles, permissions, and invitations in laravel..
It currently has 5 GitHub stars and 228 downloads on Packagist (latest version 2.0.0).
Install it with composer require roundly-consulting/teams-for-laravel.
Discover more Laravel packages by roundly-consulting
or browse all Laravel packages to compare alternatives.
Last updated
Teams, roles, permissions and invitations for any Eloquent model. Members carry a role, roles carry permissions checked through Laravel's Gate, and teams issue expiring, email-targeted invites and handle join requests. Opt-in per-team data isolation keeps each customer's rows to itself — in requests and queued jobs — and teams can nest.
Requires PHP 8.4 and Laravel 13.
composer require roundly-consulting/teams-for-laravel
php artisan vendor:publish --tag="options-migrations"
php artisan vendor:publish --tag="contacts-migrations"
php artisan vendor:publish --tag="addresses-migrations"
php artisan vendor:publish --tag="connections-migrations"
php artisan vendor:publish --tag="approvals-migrations"
php artisan vendor:publish --tag="teams-migrations"
php artisan migrate
Publish every tag: none of these packages auto-load their migrations, and the very first
Teams::create() needs the options table. If your users have UUID/ULID keys, set
TEAMS_KEY_TYPE before migrating.
Register your roles in a service provider's boot method and add HasTeams to your user:
use RoundlyConsulting\Teams\Facades\Teams;
use RoundlyConsulting\Teams\Traits\HasTeams;
Teams::roles()->register('owner', 'Owner', ['*']);
Teams::roles()->register('editor', 'Editor', ['posts.edit', 'posts.publish']);
Teams::roles()->register('member', 'Member', ['posts.view']);
class User extends Authenticatable
{
use HasTeams;
}
Then create a team, seat members and invite people:
use RoundlyConsulting\Teams\DataTransferObjects\CreateTeamData;
use RoundlyConsulting\Teams\Facades\Teams;
$team = Teams::create(new CreateTeamData(name: 'Acme', owner: $owner)); // owner joins as 'owner'
Teams::for($team)->members()->add($alice, 'editor');
$invite = Teams::for($team)->invites()->create(role: 'member', email: '[email protected]');
Teams::invites()->accept($invite->code, $jane, email: $jane->email);
$alice->can('teams.posts.publish', $team); // true
$jane->hasTeamRole($team, 'member'); // true
$owner->can('teams.owner', $team); // true
The full documentation — configuration, every feature and its API, and testing — lives on our website: roundly-consulting.com/open-source/docs/teams-for-laravel
Release notes are in CHANGELOG.md. To contribute, see the contributing guide.
This package is free and open source, built and maintained by Roundly Consulting. If it saves you time, please consider supporting our open-source work — a one-time donation, a monthly pledge on Patreon or a crypto donation helps fund maintenance, new features and new packages.
The MIT License (MIT). Please see License File for more information.
Get paid by clients abroad
Wise gives you local bank details in several currencies and converts at the mid-market rate. Useful when your invoices are not in your own currency.
Try WiseNew Laravel packages worth a look, once a month. No spam, one-click unsubscribe.