laravel-organization maintained by cleaniquecoders
Description
Provide organization related app
Author
Last update
2026/04/27 04:36
(dev-main)
License
Downloads
1 909
Tags
Laravel Organization
A comprehensive Laravel package for implementing organization-based tenancy in your application. This package provides a complete solution for managing organizations, user memberships, roles, and automatic data scoping with SOLID principles compliance.
Key Features
- 🏢 Organization Management - Complete CRUD operations with UUID and slug support
- 👥 User Membership - Flexible role-based membership system with administrators and members
- 🔒 Automatic Data Scoping - Seamless multi-tenancy through Eloquent global scopes
- ⚙️ Comprehensive Settings - Extensive JSON-based configuration system with validation
- 🧩 SOLID Principles - Contract-based architecture for flexibility and testability
- 🛠️ Developer Friendly - Built-in factories, commands, and trait-based integration
Screenshots
Organization Management

Organization Switcher

Create New Organization

Quick Start
Installation
# Install the package
composer require cleaniquecoders/laravel-organization
# Publish and run migrations
php artisan vendor:publish --tag="org-migrations"
php artisan migrate
# (Optional) Publish configuration file
php artisan vendor:publish --tag="org-config"
# (Optional) Publish views for customization
php artisan vendor:publish --tag="org-views"
Note: The migration will create
organizations,organization_userstables and add anorganization_idcolumn to youruserstable.
Basic Usage
use CleaniqueCoders\LaravelOrganization\Actions\CreateNewOrganization;
use CleaniqueCoders\LaravelOrganization\Enums\OrganizationRole;
// Create an organization
$organization = (new CreateNewOrganization())->handle($user);
// Add members
$organization->addUser($user, OrganizationRole::ADMINISTRATOR);
$organization->addUser($member, OrganizationRole::MEMBER);
// Configure settings
$organization->setSetting('app.timezone', 'America/New_York');
$organization->setSetting('features.api_access', true);
$organization->save();
Add to Your User Model
use CleaniqueCoders\LaravelOrganization\Concerns\InteractsWithUserOrganization;
use CleaniqueCoders\LaravelOrganization\Contracts\UserOrganizationContract;
class User extends Authenticatable implements UserOrganizationContract
{
use InteractsWithUserOrganization;
protected $fillable = ['name', 'email', 'password', 'organization_id'];
}
// Now you can:
$user->organizations; // Get all user's organizations
$user->currentOrganization; // Get current organization
$user->ownedOrganizations; // Get organizations user owns
$user->belongsToOrganization($id); // Check membership
$user->isAdministratorOf($id); // Check admin role
Documentation
Comprehensive documentation is available in the docs/ directory:
- 📖 Installation Guide - Detailed setup instructions
- 🚀 Usage Guide - Complete usage examples and patterns
- ⚙️ Configuration - All configuration options and customization
- 🎯 Features Overview - Complete feature breakdown
- 🔧 Contracts Documentation - SOLID principles and custom implementations
- 🧩 Components & Actions - Livewire components and action classes
Requirements
- PHP 8.4+
- Laravel 11.0+ or 12.0+
Testing
composer test
Contributing
Please see CONTRIBUTING for details.
Security
Please review our security policy on how to report security vulnerabilities.
License
The MIT License (MIT). Please see License File for more information.