azaharizaman/nexus-payroll
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\Hrmfor employee data - Integration with
Nexus\Accountingfor GL posting
📖 Documentation
Package Documentation
- Getting Started Guide - Quick start guide with prerequisites, concepts, and first integration
- API Reference - Complete documentation of all interfaces, value objects, and exceptions
- Integration Guide - Laravel and Symfony integration examples
- Basic Usage Example - Simple usage patterns
- Advanced Usage Example - Advanced scenarios and patterns
Additional Resources
IMPLEMENTATION_SUMMARY.md- Implementation progress and metricsREQUIREMENTS.md- Detailed requirementsTEST_SUITE_SUMMARY.md- Test coverage and resultsVALUATION_MATRIX.md- Package valuation metrics- See root
ARCHITECTURE.mdfor overall system architecture
License
MIT License - see LICENSE file for details.
azaharizaman/nexus-payroll 适用场景与选型建议
azaharizaman/nexus-payroll 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 05 月 04 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 azaharizaman/nexus-payroll 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 azaharizaman/nexus-payroll 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 35
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-05-04