No description
Find a file
Snider d0ad2737cb refactor: rename namespace from Core\Mod\Tenant to Core\Tenant
Simplifies the namespace hierarchy by removing the intermediate Mod
segment. Updates all 118 files including models, services, controllers,
middleware, tests, and composer.json autoload configuration.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-27 16:30:46 +00:00
.gemini Initial commit 2026-01-26 21:03:15 +00:00
.github monorepo sepration 2026-01-27 00:31:43 +00:00
changelog/2026/jan refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Concerns refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Console/Commands refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Contracts refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Controllers refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Database refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Enums refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Events/Webhook refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Exceptions refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Features refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Jobs refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Lang/en_GB fix: namespace to Core\Mod\Tenant, restructure package 2026-01-27 00:58:42 +00:00
Listeners refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Mail refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Middleware refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Migrations fix: namespace to Core\Mod\Tenant, restructure package 2026-01-27 00:58:42 +00:00
Models refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Notifications refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Routes refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Rules refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Scopes refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
Services refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
tests/Feature refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
View refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
.editorconfig Initial commit 2026-01-26 21:03:15 +00:00
.gitattributes Initial commit 2026-01-26 21:03:15 +00:00
.gitignore Initial commit 2026-01-26 21:03:15 +00:00
AGENTS.md Initial commit 2026-01-26 21:03:15 +00:00
Boot.php refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
CLAUDE.md monorepo sepration 2026-01-26 21:08:59 +00:00
cliff.toml Initial commit 2026-01-26 21:03:15 +00:00
composer.json refactor: rename namespace from Core\Mod\Tenant to Core\Tenant 2026-01-27 16:30:46 +00:00
GEMINI.md Initial commit 2026-01-26 21:03:15 +00:00
LICENSE Initial commit 2026-01-26 21:03:15 +00:00
README.md monorepo sepration 2026-01-27 00:31:43 +00:00

Core Tenant

CI PHP Version Laravel License

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

Features

  • Users & 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

  • PHP 8.2+
  • Laravel 11.x or 12.x
  • Core PHP Framework (host-uk/core)

Installation

composer require host-uk/core-tenant

The service provider will be auto-discovered.

Run migrations:

php artisan migrate

Usage

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

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

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

Model Description
User Application users
Workspace Tenant workspace boundaries
WorkspaceMember Workspace membership with roles
Entitlement Feature/package entitlements
UsageRecord Usage tracking records
Referral Referral tracking

Events

The module fires events for key actions:

  • WorkspaceCreated
  • WorkspaceMemberAdded
  • WorkspaceMemberRemoved
  • EntitlementChanged
  • UsageAlertTriggered

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

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

Documentation

License

EUPL-1.2 (European Union Public Licence)