承接 azaharizaman/nexus-human-resource-operations 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

azaharizaman/nexus-human-resource-operations

Composer 安装命令:

composer require azaharizaman/nexus-human-resource-operations

包简介

HR Operations Orchestrator - Coordinates all HR domain packages including Leave, Attendance, Payroll, Employee, Shift, Disciplinary, Performance Review, Training, Recruitment, and Onboarding

README 文档

README

⚠️ REFACTORED (Dec 2025): This orchestrator has been completely refactored to follow the Advanced Orchestrator Pattern.

📖 New Architecture: See NEW_ARCHITECTURE.md for complete documentation.

📜 Previous Design: See README.OLD.md for historical reference.

Quick Start

The HumanResourceOperations orchestrator coordinates HR workflows across multiple atomic packages using a clean, maintainable architecture.

Core Components

  • Coordinators - Traffic cops that orchestrate workflows
  • DataProviders - Aggregate data from multiple packages
  • Rules - Composable validation logic
  • Services - Complex business operations
  • Workflows - Long-running stateful processes
  • Listeners - Reactive event handlers
  • DTOs - Strict type contracts

Example: Hiring Workflow

use Nexus\HumanResourceOperations\Coordinators\HiringCoordinator;
use Nexus\HumanResourceOperations\DTOs\HiringRequest;

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

$request = new HiringRequest(
    applicationId: 'app-123',
    jobPostingId: 'job-456',
    hired: true,
    decidedBy: 'manager-789',
    startDate: '2025-01-01',
    positionId: 'senior-dev',
    departmentId: 'engineering',
);

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

if ($result->success) {
    echo "Employee hired: {$result->employeeId}";
    echo "User created: {$result->userId}";
} else {
    echo "Hiring failed: {$result->message}";
    print_r($result->issues);
}

Example: Leave Application

use Nexus\HumanResourceOperations\Coordinators\LeaveCoordinator;
use Nexus\HumanResourceOperations\DTOs\LeaveApplicationRequest;

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

$request = new LeaveApplicationRequest(
    employeeId: 'emp-123',
    leaveTypeId: 'annual-leave',
    startDate: '2025-01-10',
    endDate: '2025-01-15',
    reason: 'Family vacation',
    requestedBy: 'emp-123',
);

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

if ($result->success) {
    echo "Leave approved: {$result->leaveRequestId}";
    echo "New balance: {$result->newBalance} days";
}

Architecture Principles

This orchestrator follows the Advanced Orchestrator Pattern with these golden rules:

  1. Coordinators are Traffic Cops, not Workers - They direct flow, don't do work
  2. Data Fetching is Abstracted - DataProviders aggregate cross-package data
  3. Validation is Composable - Rules are individual, testable classes
  4. Strict Contracts - Always use DTOs, never raw arrays
  5. System First - Always use Nexus packages (Identity, Notifier, AuditLogger, etc.)

See NEW_ARCHITECTURE.md for complete details.

Directory Structure

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

Available Coordinators

Coordinator Purpose Key Operations
HiringCoordinator Process hiring decisions processHiringDecision()
LeaveCoordinator Manage leave applications applyLeave(), approveLeave(), cancelLeave()
AttendanceCoordinator (Planned) Attendance tracking recordCheckIn(), detectAnomalies()
PayrollCoordinator (Planned) Payroll processing calculatePayroll(), generatePayslip()

Authorization Policies

This orchestrator uses Nexus\Identity for context-aware authorization via PolicyEvaluatorInterface.

Policy-Based Authorization (ABAC)

Complex authorization scenarios (e.g., "Can user apply leave on behalf of employee?") are handled by policies that check relationships and context:

use Nexus\Identity\Contracts\PolicyEvaluatorInterface;

// In ProxyApplicationAuthorizedRule
$canApply = $this->policyEvaluator->evaluate(
    user: $applicant,
    action: 'hrm.leave.apply_on_behalf',
    resource: null,
    context: [
        'target_employee_id' => $context->employeeId,
    ]
);

Registering Policies

Policies must be registered in your application's service provider:

use Nexus\Identity\Contracts\PolicyEvaluatorInterface;
use Nexus\Identity\ValueObjects\Policy;
use Nexus\Hrm\Contracts\EmployeeQueryInterface;

public function boot(): void
{
    $policyEvaluator = $this->app->make(PolicyEvaluatorInterface::class);
    $employeeQuery = $this->app->make(EmployeeQueryInterface::class);
    
    // Register leave proxy policy
    $policy = Policy::define('hrm.leave.apply_on_behalf')
        ->description('User can apply leave on behalf of employees in same department or as manager')
        ->check(function($user, $action, $resource, $context) use ($employeeQuery) {
            $targetEmployeeId = $context['target_employee_id'] ?? null;
            if (!$targetEmployeeId) {
                return false;
            }
            
            $userEmployee = $employeeQuery->findByUserId($user->getId());
            $targetEmployee = $employeeQuery->findById($targetEmployeeId);
            
            if (!$userEmployee || !$targetEmployee) {
                return false;
            }
            
            // Same department OR user is manager
            return $userEmployee->getDepartmentId() === $targetEmployee->getDepartmentId()
                || $userEmployee->getId() === $targetEmployee->getManagerId();
        });
    
    $policyEvaluator->registerPolicy($policy->getName(), $policy->getEvaluator());
}

📖 See: adapters/Laravel/HRM/docs/POLICY_REGISTRATION_EXAMPLE.md for complete examples.

📖 See: CODING_GUIDELINES.md - Section 5.1 for authorization patterns.

Installation

composer require azaharizaman/nexus-human-resource-operations

Dependencies:

  • azaharizaman/nexus-hrm - Employee management
  • azaharizaman/nexus-identity - User accounts and authorization
  • azaharizaman/nexus-party - Party records
  • azaharizaman/nexus-org-structure - Organizational hierarchy
  • azaharizaman/nexus-leave - Leave management
  • azaharizaman/nexus-notifier - Notifications
  • azaharizaman/nexus-audit-logger - Audit trails

Testing

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

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

Migration Guide

If migrating from the old architecture:

  1. UseCases → Coordinators - Entry points
  2. Pipelines → Workflows - Long-running processes
  3. Inline validation → Rules - Composable validation
  4. Array params → DTOs - Typed contracts
  5. Direct repo calls → DataProviders - Data aggregation

See NEW_ARCHITECTURE.md for complete migration guide.

License

MIT License

Documentation:

azaharizaman/nexus-human-resource-operations 适用场景与选型建议

azaharizaman/nexus-human-resource-operations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 0 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 azaharizaman/nexus-human-resource-operations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 azaharizaman/nexus-human-resource-operations 我们能提供哪些服务?
定制开发 / 二次开发

基于 azaharizaman/nexus-human-resource-operations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 36
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-05-04