A modern, tenant-ready teams management package for Laravel 12+ applications. Built for collaboration, scalability, and multi-tenancy from the ground up.
Note: This package is part of the Litepie ecosystem and is open source under the MIT license. Perfect for SaaS applications, multi-tenant platforms, and collaborative tools.
- ๐ข Multi-Tenant Ready: Complete tenant isolation with Litepie Tenancy
- ๐ฅ Team Management: Create, manage, and organize teams with hierarchical structures
- ๏ฟฝ Role-Based Access: Built-in role and permission management system
- ๐ Workflow Integration: Team workflows with Litepie Flow
- โก Action Pattern: Built on Litepie Actions for clean business logic
- ๐ File Management: Team file sharing with Litepie Filehub
- ๐ Modern Laravel: Laravel 12+ ready with PHP 8.2+ support
- ๐จ Rich API: RESTful API with comprehensive resources
- ๐ Team Analytics: Performance metrics and insights
- ๐ Real-time Events: WebSocket support for live collaboration
- ๐งช Fully Tested: Comprehensive test suite with 95%+ coverage
- Installation
- Quick Start
- Configuration
- Basic Usage
- Multi-Tenant Usage
- Workflows
- Permissions & Roles
- File Management
- API Integration
- Events
- Testing
- Roadmap
- Contributing
- Changelog
- Security
- License
Install the package via Composer:
composer require litepie/teamsPublish and run the migrations:
php artisan vendor:publish --tag="teams-migrations"
php artisan migratePublish the configuration file:
php artisan vendor:publish --tag="teams-config"The configuration file config/teams.php provides extensive customization options:
return [
'model' => [
'team' => \Litepie\Teams\Models\Team::class,
'team_member' => \Litepie\Teams\Models\TeamMember::class,
'team_invitation' => \Litepie\Teams\Models\TeamInvitation::class,
],
'features' => [
'tenancy' => true,
'workflows' => true,
'file_management' => true,
'real_time_events' => true,
'team_analytics' => true,
],
'permissions' => [
'auto_create' => true,
'middleware' => ['team.member'],
],
'invitations' => [
'expires_after_days' => 7,
'max_pending_per_team' => 50,
],
];Add the HasTeams trait to your User model:
use Litepie\Teams\Traits\HasTeams;
class User extends Authenticatable
{
use HasTeams;
// Your existing model code
}use Litepie\Teams\Actions\CreateTeamAction;
$team = CreateTeamAction::execute(null, [
'name' => 'Development Team',
'description' => 'Our amazing development team',
'type' => 'development',
'settings' => [
'visibility' => 'private',
'features' => ['file_sharing', 'workflows'],
'limits' => ['max_members' => 50],
],
], $user);use Litepie\Teams\Actions\AddTeamMemberAction;
// Add a member with specific role
AddTeamMemberAction::execute($team, [
'user_id' => $user->id,
'role' => 'member',
'permissions' => ['view_team', 'create_posts'],
], $teamOwner);
// Invite via email
use Litepie\Teams\Actions\InviteTeamMemberAction;
InviteTeamMemberAction::execute($team, [
'email' => '[email protected]',
'role' => 'member',
'message' => 'Welcome to our team!',
], $teamOwner);Teams seamlessly integrates with tenant-based applications:
// Set tenant context
tenancy()->initialize($tenant);
// All team operations are now scoped to the current tenant
$teams = Team::current()->get(); // Only returns current tenant's teams
// Create tenant-specific team
$team = CreateTeamAction::execute(null, [
'name' => 'Tenant Development Team',
'tenant_id' => tenancy()->current()?->id,
], $user);
// Team permissions are automatically tenant-scoped
$user->can('manage', $team); // Checks within current tenant contextIntegrate team workflows for automated processes:
use Litepie\Teams\Workflows\TeamWorkflow;
// Team lifecycle workflow
$workflow = TeamWorkflow::create();
// Available states: draft, active, suspended, archived
// Available transitions: activate, suspend, archive, restore
// Transition team through workflow
$team->transitionTo('active', [
'activated_by' => $user->id,
'reason' => 'Team setup completed',
]);
// Check current state
if ($team->getCurrentState()->getName() === 'active') {
// Team is active
}Teams provides a built-in role and permission management system:
// Team-level permissions
$team->addMember($user, 'admin');
$team->addMember($user, 'member');
// Check team-specific permissions
if ($team->userHasRole($user, 'admin')) {
// User is an admin of this team
}
if ($team->userHasPermission($user, 'edit_team_settings')) {
// User can edit team settings
}
// Update member role
$team->updateMemberRole($user, 'moderator');
// Update member permissions
$team->updateMemberPermissions($user, ['edit_content', 'manage_files']);Teams provides integrated file management through Litepie Filehub:
// Upload team files
$team->attachFile($request->file('document'), 'documents', [
'uploader_id' => $user->id,
'title' => 'Team Charter',
'visibility' => 'team_members',
]);
// Get team files
$documents = $team->getFiles('documents');
$avatars = $team->getFiles('avatars');
// File permissions
$file = $team->getFirstFile('logo');
if ($user->can('download', $file)) {
return $file->downloadResponse();
}Teams provides a comprehensive RESTful API:
// API routes are automatically registered
Route::middleware(['api', 'tenant.required'])->group(function () {
Route::apiResource('teams', TeamController::class);
Route::apiResource('teams.members', TeamMemberController::class);
Route::apiResource('teams.invitations', TeamInvitationController::class);
});
// API Resources
$team = Team::find(1);
return new TeamResource($team);
// Returns: team data with members, files, permissions, etc.Teams fires comprehensive events for real-time features:
// Listen to team events
Event::listen(TeamCreated::class, function ($event) {
// Send welcome notifications
NotifyTeamCreated::dispatch($event->team);
});
Event::listen(MemberJoinedTeam::class, function ($event) {
// Update team analytics
UpdateTeamMetrics::dispatch($event->team);
});
// Real-time broadcasting
class MemberJoinedTeam implements ShouldBroadcast
{
public function broadcastOn()
{
return new PrivateChannel("team.{$this->team->id}");
}
}Teams includes comprehensive testing utilities:
use Litepie\Teams\Testing\TeamTestHelpers;
class TeamFeatureTest extends TestCase
{
use TeamTestHelpers;
public function test_user_can_create_team()
{
$user = User::factory()->create();
$tenant = $this->createTenant();
$this->actingAsTenant($tenant)
->actingAs($user);
$team = $this->createTeam([
'name' => 'Test Team',
'owner_id' => $user->id,
]);
$this->assertDatabaseHas('teams', [
'name' => 'Test Team',
'tenant_id' => $tenant->id,
]);
$this->assertTrue($user->ownsTeam($team));
}
}use Litepie\Teams\Analytics\TeamAnalytics;
$analytics = TeamAnalytics::for($team)
->period('last_30_days')
->metrics(['activity', 'files', 'members'])
->get();
// Get insights
$insights = $team->getAnalytics([
'member_activity' => true,
'file_usage' => true,
'collaboration_metrics' => true,
]);use Litepie\Teams\Templates\TeamTemplate;
// Create team from template
$template = TeamTemplate::find('development_team');
$team = $template->createTeam([
'name' => 'New Dev Team',
'owner_id' => $user->id,
]);
// Templates include predefined roles, permissions, and workflowsuse Litepie\Teams\Actions\BulkTeamOperationsAction;
// Bulk member operations
BulkTeamOperationsAction::execute($team, [
'operation' => 'add_members',
'users' => [$user1->id, $user2->id, $user3->id],
'role' => 'member',
]);
// Bulk permission updates
BulkTeamOperationsAction::execute($team, [
'operation' => 'update_permissions',
'members' => [$user1->id, $user2->id],
'permissions' => ['edit_content', 'manage_files'],
]);We're continuously improving Lavalite Teams. Here's what's coming next:
- Team templates and blueprints
- Advanced team analytics dashboard
- Integration with popular project management tools
- Team chat integration
- Mobile SDK for teams
- AI-powered team insights
- Advanced workflow automation
- Team performance metrics
- Custom team widgets
- GraphQL API support
Want to contribute to these features? Check out our contributing guide!
We love contributions! Please see CONTRIBUTING.md for details on:
- ๐ Bug Reports: How to report bugs effectively
- ๐ก Feature Requests: Proposing new features
- ๐ง Pull Requests: Code contribution guidelines
- ๐ Documentation: Improving our docs
- ๐งช Testing: Adding and running tests
-
Fork and Clone
git clone https://github.com/your-username/teams.git cd teams -
Install Dependencies
composer install npm install
-
Setup Testing Environment
cp .env.example .env php artisan key:generate php artisan migrate --env=testing
-
Run Tests
composer test composer test:coverage
We follow PSR-12 coding standards:
composer format # Fix code style
composer analyse # Run static analysis
composer test:types # Check type coveragePlease see CHANGELOG.md for more information on what has changed recently.
Major releases and their highlights:
- v2.0.0 - Multi-tenancy support, workflow integration
- v1.5.0 - File management, advanced permissions
- v1.0.0 - Initial stable release
If you discover any security-related issues, please email [email protected] instead of using the issue tracker. All security vulnerabilities will be promptly addressed.
- ๐ก๏ธ Tenant Isolation: Complete data separation between tenants
- ๐ Permission System: Granular role-based access control
- ๐ Audit Logging: Complete activity tracking
- ๐ซ Input Validation: Comprehensive request validation
- ๐ File Security: Secure file uploads and access controls
The MIT License (MIT). Please see License File for more information.
This package is open source software licensed under the MIT license.
- Created by: Renfos Technologies
- Maintained by: Litepie Development Team
- Contributors: All Contributors
Special thanks to all the developers who have contributed to making this package better!
- ๐ Documentation: teams.litepie.com
- ๐ Bug Reports: GitHub Issues
- ๐ฌ Discussions: GitHub Discussions
- ๐ง Email Support: [email protected]
- ๐ผ Commercial Support: Contact Us
Please be respectful and constructive in all interactions. See our Code of Conduct for more details.
This project is maintained by Renfos Technologies and supported by our amazing sponsors:
- Want to sponsor this project? Become a sponsor
Built with โค๏ธ by the Renfos Technologies Team
Lavalite Teams - Where collaboration meets innovation.
โญ Star us on GitHub | ๐ฆ Follow us on Twitter | ๐ผ Visit Renfos