PHPackages                             dappcore/php-tenant - 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. dappcore/php-tenant

ActiveLibrary

dappcore/php-tenant
===================

Multi-tenancy and workspaces for Laravel

v0.1.0(today)020↑2900%[3 PRs](https://github.com/dAppCore/php-tenant/pulls)1EUPL-1.2PHPPHP ^8.2CI failing

Since Feb 20Pushed todayCompare

[ Source](https://github.com/dAppCore/php-tenant)[ Packagist](https://packagist.org/packages/dappcore/php-tenant)[ Fund](https://donate.trees.org/-/NPMMSVUP?member=SWZTDDWH)[ RSS](/packages/dappcore-php-tenant/feed)WikiDiscussions main Synced today

READMEChangelog (4)Dependencies (4)Versions (9)Used By (1)

Core Tenant
===========

[](#core-tenant)

[![CI](https://github.com/lthn/php-tenant/actions/workflows/ci.yml/badge.svg)](https://github.com/lthn/php-tenant/actions/workflows/ci.yml)[![PHP Version](https://camo.githubusercontent.com/5b5c39a932457ffa24c2e33561a10fdbb141ae5644fbb896cf255afb1949b52b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6c74686e2f7068702d74656e616e74)](https://packagist.org/packages/lthn/php-tenant)[![Laravel](https://camo.githubusercontent.com/fdd64552ac661b58d315697b42c89b5d44c25312e21c4b0db544320acb57205f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31312e7825323025374325323031322e782d4646324432303f6c6f676f3d6c61726176656c)](https://laravel.com)[![License](https://camo.githubusercontent.com/3b7871a41ea959dc3dcb73b77db0dd13b838353d6ffc04e3b2ecd170f15e4212/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4555504c2d2d312e322d626c75652e737667)](LICENSE)

Multi-tenancy module for the Core PHP Framework providing users, workspaces, and entitlements.

Features
--------

[](#features)

- **Users &amp; Authentication** - User management with 2FA support
- **Workspaces** - Multi-tenant workspace boundaries
- **Entitlements** - Feature access, packages, and usage tracking
- **Account Management** - User settings, account deletion
- **Referrals** - Referral system support
- **Usage Alerts** - Configurable usage threshold alerts

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

[](#requirements)

- PHP 8.2+
- Laravel 11.x or 12.x
- Core PHP Framework (`lthn/php`)

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

[](#installation)

```
composer require lthn/php-tenant
```

The service provider will be auto-discovered.

Run migrations:

```
php artisan migrate
```

Usage
-----

[](#usage)

### Workspace Management

[](#workspace-management)

```
use Core\Mod\Tenant\Services\WorkspaceManager;
use Core\Mod\Tenant\Services\WorkspaceService;

// Get current workspace
$workspace = app(WorkspaceManager::class)->current();

// Create a new workspace
$workspace = app(WorkspaceService::class)->create([
    'name' => 'My Workspace',
    'owner_id' => $user->id,
]);
```

### Entitlements

[](#entitlements)

```
use Core\Mod\Tenant\Services\EntitlementService;

$entitlements = app(EntitlementService::class);

// Check if workspace has access to a feature
if ($entitlements->hasAccess($workspace, 'premium_feature')) {
    // Feature is enabled
}

// Check usage limits
$usage = $entitlements->getUsage($workspace, 'api_calls');
```

### Middleware

[](#middleware)

The module provides middleware for workspace-based access control:

```
// In your routes
Route::middleware('workspace.permission:manage-users')->group(function () {
    // Routes requiring manage-users permission
});
```

Models
------

[](#models)

ModelDescription`User`Application users`Workspace`Tenant workspace boundaries`WorkspaceMember`Workspace membership with roles`Entitlement`Feature/package entitlements`UsageRecord`Usage tracking records`Referral`Referral trackingEvents
------

[](#events)

The module fires events for key actions:

- `WorkspaceCreated`
- `WorkspaceMemberAdded`
- `WorkspaceMemberRemoved`
- `EntitlementChanged`
- `UsageAlertTriggered`

Artisan Commands
----------------

[](#artisan-commands)

```
# Refresh user statistics
php artisan tenant:refresh-user-stats

# Process scheduled account deletions
php artisan tenant:process-deletions

# Check usage alerts
php artisan tenant:check-usage-alerts

# Reset billing cycles
php artisan tenant:reset-billing-cycles
```

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

[](#configuration)

The module uses the Core PHP configuration system. Key settings can be configured per-workspace or system-wide.

Documentation
-------------

[](#documentation)

- [Core PHP Framework](https://github.com/host-uk/core-php)
- [Getting Started Guide](https://core.help/guide/)

License
-------

[](#license)

EUPL-1.2 (European Union Public Licence)

###  Health Score

42

—

FairBetter than 88% of packages

Maintenance100

Actively maintained with recent releases

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~44 days

Total

4

Last Release

0d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/268332193?v=4)[dappcore](/maintainers/dappcore)[@dAppCore](https://github.com/dAppCore)

---

Top Contributors

[![Snider](https://avatars.githubusercontent.com/u/631881?v=4)](https://github.com/Snider "Snider (40 commits)")

---

Tags

multi-tenantTeamsworkspaces

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/dappcore-php-tenant/health.svg)

```
[![Health](https://phpackages.com/badges/dappcore-php-tenant/health.svg)](https://phpackages.com/packages/dappcore-php-tenant)
```

###  Alternatives

[santigarcor/laratrust

This package provides a flexible way to add Role-based Permissions to Laravel

2.3k5.8M47](/packages/santigarcor-laratrust)[hyn/multi-tenant

Run multiple websites using the same laravel installation while keeping tenant specific data separated for fully independant multi-domain setups.

2.6k1.2M9](/packages/hyn-multi-tenant)[mpociot/teamwork

User to Team associations for the Laravel 5 Framework

1.1k701.8k1](/packages/mpociot-teamwork)[tenancy/tenancy

Creating multi tenant saas from your Laravel app with ease

1.3k46.2k](/packages/tenancy-tenancy)[sebbmeyer/php-microsoft-teams-connector

PHP Microsoft Teams Connector

1201.1M3](/packages/sebbmeyer-php-microsoft-teams-connector)[andrewdwallo/filament-companies

A comprehensive Laravel authentication and authorization system designed for Filament, focusing on multi-tenant company management.

35156.4k2](/packages/andrewdwallo-filament-companies)

PHPackages © 2026

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