PHPackages                             azaharizaman/nexus-backoffice - 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. [Admin Panels](/categories/admin)
4. /
5. azaharizaman/nexus-backoffice

ActiveLibrary[Admin Panels](/categories/admin)

azaharizaman/nexus-backoffice
=============================

Framework-agnostic company structure, offices, departments, and staff organizational units management package for Nexus ERP

v0.1.0-alpha1(1mo ago)001MITPHPPHP ^8.3

Since May 5Pushed 1mo agoCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (1)

Nexus\\Backoffice
=================

[](#nexusbackoffice)

Framework-agnostic company structure, offices, departments, and staff organizational units management package for Nexus ERP.

Overview
--------

[](#overview)

The Backoffice package provides a comprehensive organizational structure management system for companies, including:

- **Company Hierarchy**: Multi-level parent-child company relationships for holding structures
- **Office Management**: Physical location management with types (head office, branch, regional, satellite, virtual)
- **Department Structure**: Hierarchical departmental organization independent of physical locations
- **Staff Management**: Comprehensive employee data and assignment tracking
- **Unit/Matrix Organization**: Cross-functional teams that transcend traditional hierarchy boundaries
- **Transfer Management**: Staff transfer workflows with approval and effective date scheduling
- **Organizational Charts**: Generation and visualization of organizational structures
- **Reporting**: Headcount, turnover, span of control, and vacancy reports

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

[](#architecture)

This package follows the **Nexus Architecture Principle**: "Logic in Packages, Implementation in Applications."

### Package Layer (Pure PHP)

[](#package-layer-pure-php)

- **Framework-agnostic**: No Laravel dependencies
- **Business Logic**: All organizational management rules and workflows
- **Interfaces**: Defines data structures and persistence contracts
- **Value Objects**: Immutable domain objects (CompanyStatus, OfficeType, StaffType, etc.)
- **Services**: BackofficeManager, TransferManager for orchestration

### Application Layer (Laravel/Atomy)

[](#application-layer-laravelatomy)

- **Eloquent Models**: Company, Office, Department, Staff, Unit, Transfer

### Architectural Compliance (v1.1+)

[](#architectural-compliance-v11)

As of **v1.1.0**, this package has been refactored to achieve **95%+ architectural compliance** with strict adherence to:

- **Interface Segregation Principle (ISP)**: Repository interfaces split into focused contracts

    - `*PersistenceInterface` - Write operations (save, update, delete)
    - `*QueryInterface` - Read operations (findById, getByX, etc.)
    - `*ValidationInterface` - Business rule validation (exists checks, constraints)
- **CQRS (Command Query Responsibility Segregation)**: Clear separation between commands (writes) and queries (reads)
- **Stateless Architecture**: All service classes are `final readonly` with injected dependencies
- **Domain Services**: Business logic extracted from repositories into dedicated services:

    - `CompanyHierarchyService` - Company relationship logic
    - `DepartmentHierarchyService` - Department tree operations
    - `OfficeHierarchyService` - Office management logic
    - `StaffAssignmentService` - Staff hierarchy and reporting lines
    - `UnitManagementService` - Unit membership management

**Migration Path**: Legacy repository interfaces (`CompanyRepositoryInterface`, etc.) remain for backward compatibility but are deprecated. They now extend the segregated interfaces. See deprecation notices in interface docblocks for migration guidance. Legacy interfaces will be removed in v2.0.

- **Repository Implementations**: Concrete persistence implementations
- **Database Migrations**: Schema definitions
- **Service Provider**: IoC container bindings

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

[](#installation)

```
composer require azaharizaman/nexus-backoffice:"*@dev"
```

Key Features
------------

[](#key-features)

### Company Management

[](#company-management)

- Multi-level company hierarchies (holding companies, subsidiaries)
- Company registration details (number, date, jurisdiction)
- Status tracking (active, inactive, suspended, dissolved)
- Financial year and metadata management

### Office Management

[](#office-management)

- Office types: head office, branch, regional, satellite, virtual
- Location data: address, country, postal code, timezone
- Contact details: phone, email, fax
- Operating hours and capacity tracking

### Department Management

[](#department-management)

- Hierarchical department structure up to 8 levels deep
- Department types: functional, divisional, matrix, project-based
- Cost center and budget allocation tracking
- Department head (manager) assignment

### Staff Management

[](#staff-management)

- Comprehensive staff profiles with personal and employment details
- Staff types: permanent, contract, temporary, intern, consultant
- Status tracking: active, inactive, on leave, terminated
- Multiple department assignments with different roles
- Supervisor-subordinate relationships
- Skills, competencies, qualifications tracking

### Unit/Matrix Organization

[](#unitmatrix-organization)

- Cross-functional teams spanning departments and offices
- Unit types: project team, committee, task force, working group, CoE
- Member roles: leader, member, secretary, advisor
- Temporary units with start and end dates

### Transfer Management

[](#transfer-management)

- Transfer types: promotion, lateral move, demotion, relocation
- Multi-level approval workflows
- Effective date scheduling (future or within 30 days past)
- Transfer history and rollback support

### Reporting &amp; Analytics

[](#reporting--analytics)

- Organizational charts (hierarchical tree, matrix view, circle pack)
- Headcount reports by company, office, department, type, status
- Turnover and retention metrics
- Span of control reports
- Vacancy reports

Usage
-----

[](#usage)

### Basic Company Setup

[](#basic-company-setup)

```
use Nexus\Backoffice\Services\BackofficeManager;

$manager = app(BackofficeManager::class);

// Create a company
$company = $manager->createCompany([
    'code' => 'ABC',
    'name' => 'ABC Corporation',
    'registration_number' => '123456789',
    'registration_date' => '2020-01-01',
    'status' => 'active',
]);

// Add head office
$office = $manager->createOffice([
    'company_id' => $company->getId(),
    'code' => 'HQ',
    'name' => 'Head Office',
    'type' => 'head_office',
    'address_line1' => '123 Main Street',
    'city' => 'Kuala Lumpur',
    'country' => 'Malaysia',
    'postal_code' => '50000',
]);

// Create department
$department = $manager->createDepartment([
    'company_id' => $company->getId(),
    'code' => 'IT',
    'name' => 'Information Technology',
    'type' => 'functional',
]);

// Onboard staff
$staff = $manager->createStaff([
    'employee_id' => 'EMP001',
    'first_name' => 'John',
    'last_name' => 'Doe',
    'email' => 'john.doe@abc.com',
    'hire_date' => '2024-01-01',
    'type' => 'permanent',
    'status' => 'active',
]);

// Assign staff to department
$manager->assignStaffToDepartment(
    $staff->getId(),
    $department->getId(),
    'Software Engineer',
    true // is_primary
);
```

### Transfer Management

[](#transfer-management-1)

```
use Nexus\Backoffice\Services\TransferManager;

$transferManager = app(TransferManager::class);

// Create transfer request
$transfer = $transferManager->createTransferRequest([
    'staff_id' => $staff->getId(),
    'from_department_id' => $currentDepartment->getId(),
    'to_department_id' => $newDepartment->getId(),
    'transfer_type' => 'promotion',
    'effective_date' => '2024-06-01',
    'reason' => 'Promotion to Senior Developer',
]);

// Approve transfer
$transferManager->approveTransfer(
    $transfer->getId(),
    $approverId,
    'Approved for promotion'
);
```

### Organizational Chart

[](#organizational-chart)

```
// Generate organizational chart
$orgChart = $manager->generateOrganizationalChart(
    $company->getId(),
    'hierarchical_tree'
);

// Export to JSON
$json = $manager->exportOrganizationalChart(
    $orgChart,
    'json'
);
```

Business Rules
--------------

[](#business-rules)

### Company Rules

[](#company-rules)

- Company codes must be unique across the system
- Company registration number must be unique when provided
- Parent company relationship cannot create circular references
- Inactive companies cannot have new staff assignments
- Parent company must be active to have active children

### Office Rules

[](#office-rules)

- Office codes must be unique within the same company
- Office hierarchy cannot exceed company boundaries
- Only one head office per company
- Office cannot be deleted if it has active staff assignments
- Office address must include country and postal code

### Department Rules

[](#department-rules)

- Department codes must be unique within the same parent department
- Department hierarchy is independent of office structure
- Department cannot be deleted if it has active staff or sub-departments
- Department hierarchy depth recommended maximum is 8 levels
- Cost center code must be unique within company when provided

### Staff Rules

[](#staff-rules)

- Staff employee ID must be unique across entire system
- Staff codes must be unique system-wide
- Staff email address must be unique within company when provided
- Staff can only have one primary supervisor per company
- Supervisor must be in same or parent organizational unit
- Staff cannot be their own supervisor (direct or indirect)
- Supervisor chain cannot exceed 15 levels
- Terminated staff cannot have active assignments

### Transfer Rules

[](#transfer-rules)

- Transfer requires approval from authorized users
- Transfer effective dates cannot be retroactive beyond 30 days
- Pending transfer blocks new transfers for same staff
- Transfer approval requires authorized approver at source and destination

Multi-Tenancy
-------------

[](#multi-tenancy)

The package supports multi-tenancy via tenant context injection. All operations are automatically scoped to the current tenant when integrated with the `Nexus\Tenant` package.

Performance
-----------

[](#performance)

- Organizational chart generation: &lt; 2 seconds for 10,000 staff
- Staff search and filtering: &lt; 500ms
- Hierarchical queries (ancestors/descendants): &lt; 100ms
- Support up to 100,000 staff records per company

Security
--------

[](#security)

- Tenant isolation enforced at repository level
- Role-based access control for organizational management operations
- Field-level security for sensitive staff information
- Audit trail for all organizational changes
- Data encryption at rest and in transit

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

[](#requirements)

- PHP 8.3 or higher
- No framework dependencies (framework-agnostic)

License
-------

[](#license)

MIT License. See LICENSE file for details.

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

[](#documentation)

### Quick Links

[](#quick-links)

- 📘 [Getting Started Guide](docs/getting-started.md) - Comprehensive setup and usage tutorial
- 📚 [API Reference](docs/api-reference.md) - Complete interface and service documentation
- 🔧 [Integration Guide](docs/integration-guide.md) - Laravel and Symfony integration examples
- 💡 [Basic Examples](docs/examples/basic-usage.php) - Company, office, department setup examples
- 🚀 [Advanced Examples](docs/examples/advanced-usage.php) - Hierarchies, matrix organizations, transfer workflows

### Package Documentation

[](#package-documentation)

- 📋 [Requirements](REQUIREMENTS.md) - Detailed requirements specifications (474 requirements)
- 📊 [Implementation Summary](IMPLEMENTATION_SUMMARY.md) - Development progress and metrics
- ✅ [Test Suite Summary](TEST_SUITE_SUMMARY.md) - Test coverage and strategy (95 tests planned)
- 💰 [Valuation Matrix](VALUATION_MATRIX.md) - Package valuation and ROI analysis ($120K)

### Additional Resources

[](#additional-resources)

- 🏗️ [Architecture Guidelines](../../ARCHITECTURE.md) - Nexus architecture principles
- 📖 [Package Reference](../../docs/NEXUS_PACKAGES_REFERENCE.md) - All Nexus packages overview

Integration with Other Packages
-------------------------------

[](#integration-with-other-packages)

This package integrates with:

- **Nexus\\Tenant** - Multi-tenancy context
- **Nexus\\Identity** - Authorization and role management
- **Nexus\\AuditLogger** - Organizational change tracking
- **Nexus\\Telemetry** - Performance metrics and health checks
- **Nexus\\Hrm** - Human resources management
- **Nexus\\Payroll** - Payroll processing (staff assignment data)
- **Nexus\\Finance** - Cost center and budget management

Contributing
------------

[](#contributing)

This package is part of the Nexus monorepo. Please refer to the main repository for contribution guidelines.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance93

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

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

36d ago

### Community

Maintainers

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

---

Tags

hierarchybackofficeERPcompany managementnexusorganizational-structurestaff-management

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[roadiz/roadiz

Roadiz is a modern CMS based on a polymorphic content-schema system which can handle many types of services. It’s based on Symfony component and Doctrine ORM for maximum performances and security.

3739.3k6](/packages/roadiz-roadiz)[openplain/filament-tree-view

Tree view for Filament resources - drop-in replacement for Table with drag-and-drop hierarchical data management

3621.1k](/packages/openplain-filament-tree-view)

PHPackages © 2026

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