PHPackages                             azaharizaman/nexus-tenant-operations - 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. azaharizaman/nexus-tenant-operations

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

azaharizaman/nexus-tenant-operations
====================================

Non-operational orchestrator for multi-tenant lifecycle management - defines interfaces for tenant, setting, feature flags, backoffice, and audit operations

v0.1.0-alpha1(2mo ago)02MITPHPPHP ^8.3

Since May 5Pushed 2mo agoCompare

[ Source](https://github.com/azaharizaman/nexus-tenant-operations)[ Packagist](https://packagist.org/packages/azaharizaman/nexus-tenant-operations)[ RSS](/packages/azaharizaman-nexus-tenant-operations/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (4)Versions (2)Used By (0)

Nexus\\TenantOperations
=======================

[](#nexustenantoperations)

> **Orchestrator for multi-tenant lifecycle management**
>
> Coordinates Tenant, Setting, FeatureFlags, Backoffice, AuditLogger, and Identity packages.

---

Overview
--------

[](#overview)

The **TenantOperations** orchestrator is a non-business operational orchestrator that manages multi-tenant infrastructure within the Nexus ERP system. It provides the foundation for all other operational orchestrators to function correctly in a multi-tenant environment.

### Key Capabilities

[](#key-capabilities)

- **Tenant Onboarding** - Create new tenants with settings, features, and company structure
- **Tenant Lifecycle** - Suspend, activate, archive, and delete tenants
- **Impersonation** - Admin user impersonation for support operations
- **Validation** - Tenant state validation for other orchestrators

### Value to Other Orchestrators

[](#value-to-other-orchestrators)

OrchestratorValue Provided**FinanceOperations**Validates tenant has proper licensing for financial modules**HumanResourceOperations**Validates organizational chart exists for tenant**AccountingOperations**Validates tenant has ChartOfAccount configured**SalesOperations**Validates tenant has sales configuration**ProcurementOperations**Validates tenant has supplier management enabled**SupplyChainOperations**Validates tenant has warehouse configurations**CRMOperations**Validates tenant has CRM modules enabled---

Quick Start
-----------

[](#quick-start)

### Example: Tenant Onboarding

[](#example-tenant-onboarding)

```
use Nexus\TenantOperations\Coordinators\TenantOnboardingCoordinator;
use Nexus\TenantOperations\DTOs\TenantOnboardingRequest;

$coordinator = $container->get(TenantOnboardingCoordinator::class);

$request = new TenantOnboardingRequest(
    tenantCode: 'acme-corp',
    tenantName: 'Acme Corporation',
    domain: 'acme-corp.nexuserp.com',
    adminEmail: 'admin@acme-corp.com',
    adminPassword: 'secure-password',
    plan: 'professional',
    currency: 'USD',
    timezone: 'America/New_York',
    language: 'en',
);

$result = $coordinator->onboard($request);

if ($result->success) {
    echo "Tenant created: {$result->tenantId}";
    echo "Admin user: {$result->adminUserId}";
    echo "Company: {$result->companyId}";
} else {
    echo "Onboarding failed: {$result->message}";
    print_r($result->issues);
}
```

### Example: Tenant Validation

[](#example-tenant-validation)

```
use Nexus\TenantOperations\Coordinators\TenantValidationCoordinator;
use Nexus\TenantOperations\DTOs\ModulesValidationRequest;

$coordinator = $container->get(TenantValidationCoordinator::class);

// Validate tenant has required modules
$request = new ModulesValidationRequest(
    tenantId: 'tenant-123',
    requiredModules: ['finance', 'hr', 'sales'],
);

$result = $coordinator->validateModules($request);

if ($result->valid) {
    echo "Tenant has all required modules";
} else {
    echo "Validation failed:";
    foreach ($result->errors as $error) {
        echo "- {$error['message']}";
    }
}
```

### Example: Impersonation

[](#example-impersonation)

```
use Nexus\TenantOperations\Coordinators\TenantImpersonationCoordinator;
use Nexus\TenantOperations\DTOs\ImpersonationStartRequest;

$coordinator = $container->get(TenantImpersonationCoordinator::class);

// Start impersonation
$request = new ImpersonationStartRequest(
    adminUserId: 'admin-456',
    targetTenantId: 'tenant-123',
    reason: 'Investigating user issue',
    sessionTimeoutMinutes: 30,
);

$result = $coordinator->startImpersonation($request);

if ($result->success) {
    echo "Impersonation started: {$result->sessionId}";
    echo "Expires at: {$result->expiresAt}";
}
```

---

Architecture
------------

[](#architecture)

This orchestrator follows the **Advanced Orchestrator Pattern** with these principles:

1. **Coordinators are Traffic Cops** - Direct flow, don't do work
2. **DataProviders Aggregate** - Cross-package data aggregation
3. **Rules are Composable** - Individual, testable validation classes
4. **Services do Heavy Lifting** - Complex business logic
5. **Strict Contracts** - Always use DTOs

---

Directory Structure
-------------------

[](#directory-structure)

```
src/
├── Coordinators/           # Entry points for operations
├── DataProviders/         # Cross-package data aggregation
├── Rules/                 # Validation constraints
├── Services/              # Complex business logic
├── DTOs/                 # Request/Response objects
├── Contracts/             # Interfaces
├── Exceptions/            # Domain errors
└── Workflows/           # Stateful processes (planned)

```

---

Available Coordinators
----------------------

[](#available-coordinators)

CoordinatorPurposeKey Operations`TenantOnboardingCoordinator`Create new tenants`onboard()`, `validatePrerequisites()``TenantLifecycleCoordinator`Manage tenant states`suspend()`, `activate()`, `archive()`, `delete()``TenantImpersonationCoordinator`Admin impersonation`startImpersonation()`, `endImpersonation()``TenantValidationCoordinator`Validate tenant state`validateActive()`, `validateModules()`, `validateConfiguration()`---

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

[](#installation)

```
composer require azaharizaman/nexus-tenant-operations
```

### Dependencies

[](#dependencies)

- `azaharizaman/nexus-tenant` - Core tenant management
- `azaharizaman/nexus-setting` - Tenant-specific settings
- `azaharizaman/nexus-feature-flags` - Feature flag management
- `azaharizaman/nexus-backoffice` - Company structure
- `azaharizaman/nexus-audit-logger` - Audit trail logging
- `azaharizaman/nexus-identity` - User authentication/authorization

---

Architecture Layers
-------------------

[](#architecture-layers)

```
┌─────────────────────────────────────────────────────┐
│                    Adapters (L3)                    │
│   Implements orchestrator interfaces                │
└─────────────────────────────────────────────────────┘
                          ▲ implements
┌─────────────────────────────────────────────────────┐
│              TenantOperations (L2)                  │
│   - Defines own interfaces in Contracts/            │
│   - Depends only on PSR interfaces                 │
│   - Coordinates multi-package workflows              │
└─────────────────────────────────────────────────────┘
                          ▲ uses via interfaces
┌─────────────────────────────────────────────────────┐
│              Atomic Packages (L1)                    │
│   - Tenant, Setting, FeatureFlags                   │
│   - Backoffice, AuditLogger, Identity              │
└─────────────────────────────────────────────────────┘

```

---

Testing
-------

[](#testing)

```
# Unit tests (Rules, Services)
vendor/bin/phpunit tests/Unit

# Integration tests (Coordinators)
vendor/bin/phpunit tests/Integration
```

---

License
-------

[](#license)

MIT License

---

Related Documentation
---------------------

[](#related-documentation)

- [ARCHITECTURAL.md](./ARCHITECTURAL.md) - Architecture details
- [REQUIREMENTS.md](./REQUIREMENTS.md) - Functional requirements
- [Nexus Architecture Guidelines](../../ARCHITECTURE.md) - System-wide patterns

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance84

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 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

Unknown

Total

1

Last Release

81d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/117408?v=4)[Azahari Zaman](/maintainers/azaharizaman)[@azaharizaman](https://github.com/azaharizaman)

---

Top Contributors

[![azaharizaman](https://avatars.githubusercontent.com/u/117408?v=4)](https://github.com/azaharizaman "azaharizaman (13 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/azaharizaman-nexus-tenant-operations/health.svg)

```
[![Health](https://phpackages.com/badges/azaharizaman-nexus-tenant-operations/health.svg)](https://phpackages.com/packages/azaharizaman-nexus-tenant-operations)
```

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[symfony/mailer

Helps sending emails

1.6k409.1M1.5k](/packages/symfony-mailer)[phpro/soap-client

A general purpose SoapClient library

8896.1M54](/packages/phpro-soap-client)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6942.5M425](/packages/drupal-core-recommended)[web-auth/webauthn-lib

FIDO2/Webauthn Support For PHP

12510.5M141](/packages/web-auth-webauthn-lib)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

515100.5k3](/packages/web-auth-webauthn-framework)

PHPackages © 2026

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