PHPackages                             whilesmart/eloquent-organizations - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. whilesmart/eloquent-organizations

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

whilesmart/eloquent-organizations
=================================

Organization management package for Laravel applications

v1.0.0(7mo ago)036MITPHPPHP ^8.2CI passing

Since Sep 17Pushed 7mo agoCompare

[ Source](https://github.com/whilesmartphp/eloquent-organizations)[ Packagist](https://packagist.org/packages/whilesmart/eloquent-organizations)[ RSS](/packages/whilesmart-eloquent-organizations/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (1)Dependencies (7)Versions (7)Used By (0)

Whilesmart Eloquent Organizations
=================================

[](#whilesmart-eloquent-organizations)

Organization management package for Laravel applications with role-based access control and workspace integration.

[![Latest Version on Packagist](https://camo.githubusercontent.com/75520a80d054ffb491d67c1194cafb8f52e9f031bdc5c487345634941a8dd451/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7768696c65736d6172742f656c6f7175656e742d6f7267616e697a6174696f6e732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/whilesmart/eloquent-organizations)

Features
--------

[](#features)

- **Organization Management**: Complete CRUD operations for organizations
- **Role Integration**: Built-in support for role-based access control
- **Workspace Scoping**: Optional workspace-level organization isolation
- **Polymorphic Ownership**: Organizations can be owned by any model (User, Team, etc.)
- **API Ready**: Pre-built RESTful API endpoints
- **Laravel Auto-Discovery**: Automatically registers service provider
- **Flexible Configuration**: Customizable settings and behavior

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

[](#installation)

Install the package via Composer:

```
composer require whilesmart/eloquent-organizations
```

The package will automatically register its service provider.

### Publish Configuration

[](#publish-configuration)

Optionally publish the configuration file:

```
php artisan vendor:publish --tag="organizations-config"
```

### Publish Routes

[](#publish-routes)

To customize the API routes:

```
php artisan vendor:publish --tag="organizations-routes"
```

Usage
-----

[](#usage)

### Organization Model

[](#organization-model)

The package provides a complete `Organization` model with the following attributes:

- **name**: Organization name
- **slug**: URL-friendly identifier (auto-generated)
- **type**: Organization type (company, nonprofit, etc.)
- **email**: Contact email
- **phone**: Contact phone number
- **address**: Physical address
- **website**: Website URL
- **description**: Organization description
- **owner**: Polymorphic relationship to owning model
- **is\_active**: Active status

### API Endpoints

[](#api-endpoints)

The package automatically registers these routes under `/api/organizations`:

```
GET    /api/organizations              # List organizations
POST   /api/organizations              # Create organization
GET    /api/organizations/{id}         # Show organization
PUT    /api/organizations/{id}         # Update organization
DELETE /api/organizations/{id}         # Delete organization

```

### Workspace Integration

[](#workspace-integration)

When workspace scoping is enabled, organizations are automatically filtered by workspace:

```
GET    /api/workspaces/{id}/organizations    # Workspace-scoped organizations
POST   /api/workspaces/{id}/organizations    # Create in workspace

```

### Using in Your Models

[](#using-in-your-models)

```
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Whilesmart\Organizations\Models\Organization;

class Project extends Model
{
    public function organization(): BelongsTo
    {
        return $this->belongsTo(Organization::class);
    }
}
```

### Creating Organizations

[](#creating-organizations)

```
use Whilesmart\Organizations\Models\Organization;

$organization = Organization::create([
    'name' => 'Acme Corporation',
    'type' => 'company',
    'email' => 'contact@acme.com',
    'website' => 'https://acme.com',
    'owner_type' => 'App\Models\User',
    'owner_id' => $user->id,
    'is_active' => true,
]);
```

### Role-Based Access Control

[](#role-based-access-control)

The package integrates with `whilesmart/eloquent-roles` for permission management:

```
// Check if user can manage organizations
$user->hasPermission('manage-organizations');

// Check within specific workspace context
$user->hasPermission('manage-organizations', 'workspace', $workspaceId);
```

Configuration
-------------

[](#configuration)

The default configuration includes:

```
return [
    'workspace_scoped' => true,  // Enable workspace-level scoping
    'require_owner' => true,     // Organizations must have an owner
    'auto_slug' => true,         // Auto-generate slugs from names
];
```

Requirements
------------

[](#requirements)

- PHP ^8.2
- Laravel ^11.0|^12.0
- whilesmart/eloquent-roles ^1.0

Suggested Packages
------------------

[](#suggested-packages)

- **whilesmart/eloquent-workspaces**: For workspace integration support

License
-------

[](#license)

The MIT License (MIT).

###  Health Score

35

—

LowBetter than 79% of packages

Maintenance63

Regular maintenance activity

Popularity7

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75% of commits — single point of failure

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

223d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1ca6f6e01ecbfe6640ff410c4f0321054fb48d05a5f843c2b89887b90369bcd?d=identicon)[whilesmart](/maintainers/whilesmart)

---

Top Contributors

[![kofimokome](https://avatars.githubusercontent.com/u/21100923?v=4)](https://github.com/kofimokome "kofimokome (9 commits)")[![nfebe](https://avatars.githubusercontent.com/u/14317775?v=4)](https://github.com/nfebe "nfebe (3 commits)")

---

Tags

phplaravelpackageorganization

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/whilesmart-eloquent-organizations/health.svg)

```
[![Health](https://phpackages.com/badges/whilesmart-eloquent-organizations/health.svg)](https://phpackages.com/packages/whilesmart-eloquent-organizations)
```

###  Alternatives

[nunomaduro/essentials

Just better defaults for your Laravel projects.

1.2k317.5k51](/packages/nunomaduro-essentials)[netojose/laravel-bootstrap-4-forms

Bootstrap 4 form builder for Laravel 5

182115.3k](/packages/netojose-laravel-bootstrap-4-forms)[wujunze/money-wrapper

MoneyPHP Wrapper

113.8k](/packages/wujunze-money-wrapper)

PHPackages © 2026

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