azaharizaman/nexus-payroll 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

azaharizaman/nexus-payroll

最新稳定版本:v0.1.0-alpha1

Composer 安装命令:

composer require azaharizaman/nexus-payroll

包简介

Country-agnostic atomic payroll engine for Nexus ERP

README 文档

README

Country-agnostic atomic payroll engine for Nexus ERP.

Features

  • Country-Agnostic Core: No statutory logic in core package
  • Plug-and-Play Statutory Modules: Country-specific calculations via StatutoryCalculatorInterface
  • Flexible Component System: Configurable earnings, deductions, and contributions
  • Bulk Processing: Efficient payroll runs for entire departments or companies
  • Comprehensive Payslip Generation: Detailed breakdown with audit trails
  • Framework-Agnostic Design: Pure PHP business logic

Architecture

This package is designed to be completely country-agnostic. All statutory calculations (tax, social security, pension contributions, etc.) are delegated to external implementations of StatutoryCalculatorInterface.

Example: Malaysia Statutory Package

// Separate package: azaharizaman/nexus-payroll-mys-statutory
class MalaysiaStatutoryCalculator implements StatutoryCalculatorInterface
{
    public function calculate(PayloadInterface $payload): DeductionResultInterface
    {
        // EPF, SOCSO, EIS, PCB tax calculations specific to Malaysia
    }
}

Package Structure

src/
├── Contracts/              # Interfaces for all payroll entities
├── Services/               # Country-agnostic business logic
├── ValueObjects/           # Immutable domain value objects
└── Exceptions/             # Domain-specific exceptions

Installation

composer require azaharizaman/nexus-payroll

For country-specific statutory calculations:

# Malaysia
composer require azaharizaman/nexus-payroll-mys-statutory

# Singapore
composer require azaharizaman/nexus-payroll-sgp-statutory

Usage

Payroll Processing

use Nexus\Payroll\Services\PayrollEngine;

$payrollEngine = app(PayrollEngine::class);

// Process payroll for specific period
$payslips = $payrollEngine->processPeriod(
    tenantId: $tenantId,
    periodStart: '2025-01-01',
    periodEnd: '2025-01-31',
    filters: ['department_id' => $departmentId]
);

Component Management

use Nexus\Payroll\Services\ComponentManager;

$componentManager = app(ComponentManager::class);

// Create earnings component
$basicSalaryComponent = $componentManager->createComponent([
    'name' => 'Basic Salary',
    'code' => 'BASIC',
    'type' => 'earning',
    'calculation_method' => 'fixed',
]);

// Create deduction component
$loanDeduction = $componentManager->createComponent([
    'name' => 'Loan Deduction',
    'code' => 'LOAN',
    'type' => 'deduction',
    'calculation_method' => 'fixed_amount',
]);

Statutory Calculator Registration

// In your application service provider
use Nexus\Payroll\Contracts\StatutoryCalculatorInterface;
use App\Payroll\MalaysiaStatutoryCalculator;

$this->app->singleton(StatutoryCalculatorInterface::class, function ($app) {
    return new MalaysiaStatutoryCalculator(
        epfRate: 0.11,
        employerEpfRate: 0.13,
        // ... other Malaysian statutory rates
    );
});

Key Contracts

StatutoryCalculatorInterface

The core interface for country-specific implementations:

interface StatutoryCalculatorInterface
{
    public function calculate(PayloadInterface $payload): DeductionResultInterface;
    public function getSupportedCountryCode(): string;
    public function getRequiredEmployeeFields(): array;
}

PayloadInterface

Input data structure for statutory calculations:

interface PayloadInterface
{
    public function getEmployeeId(): string;
    public function getGrossPay(): float;
    public function getTaxableIncome(): float;
    public function getMetadata(): array;
}

DeductionResultInterface

Output structure from statutory calculations:

interface DeductionResultInterface
{
    public function getTotalDeductions(): float;
    public function getBreakdown(): array;
    public function getEmployerContributions(): array;
}

Requirements

  • PHP 8.3 or higher
  • Integration with Nexus\Hrm for employee data
  • Integration with Nexus\Accounting for GL posting

📖 Documentation

Package Documentation

Additional Resources

  • IMPLEMENTATION_SUMMARY.md - Implementation progress and metrics
  • REQUIREMENTS.md - Detailed requirements
  • TEST_SUITE_SUMMARY.md - Test coverage and results
  • VALUATION_MATRIX.md - Package valuation metrics
  • See root ARCHITECTURE.md for overall system architecture

License

MIT License - see LICENSE file for details.

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固