定制 riod94/payroll-calculator-indonesia 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

riod94/payroll-calculator-indonesia

Composer 安装命令:

composer require riod94/payroll-calculator-indonesia

包简介

A comprehensive Indonesian payroll calculator library for PHP projects with tax calculations (PPh21, PPh23, PPh26).

README 文档

README

Latest Version on Packagist Total Downloads License PHP Version

A comprehensive payroll calculator library for PHP projects with Indonesian tax calculations (PPh21, PPh23, PPh26).

Features

  • PPh21 Calculation: Complete Indonesian income tax calculation for employees
  • PPh23 Calculation: Withholding tax for services, rentals, and other payments (2025 compliant)
  • PPh26 Calculation: Final withholding tax with 20% rate (2025 compliant)
  • Multiple Calculation Methods: NETT, GROSS, and GROSS_UP support
  • Overtime Calculation: Complete overtime payment calculation
  • BPJS Integration: BPJS Kesehatan and BPJS Ketenagakerjaan calculations
  • PTKP Support: All PTKP statuses (TK/0, TK/1, TK/2, TK/3, K/0, K/1, K/2, K/3)
  • NPWP Surcharge: Automatic surcharge calculation for non-NPWP holders

Installation

Install the package via Composer:

composer require riod94/payroll-calculator-indonesia

Quick Start

Basic Usage

<?php

require 'vendor/autoload.php';

use PayrollCalculator\PayrollCalculator;
use PayrollCalculator\Constants\CalculationConstants;

// Create employee
$employee = new PayrollCalculator\DataStructures\Employee(
    name: 'John Doe',
    earnings: new PayrollCalculator\DataStructures\Earnings(
        base: 10000000, // Basic salary
        fixedAllowance: 2000000 // Fixed allowance
    ),
    taxable: true,
    hasNPWP: true
);

// Initialize calculator
$calculator = new PayrollCalculator($employee);

// Calculate with GROSS method
$result = $calculator->getCalculation();

// Get results
echo "Take Home Pay: " . number_format($result->takeHomePay, 2) . "\n";
echo "Monthly Gross: " . number_format($result->earnings->monthly->gross, 2) . "\n";
echo "Monthly Nett: " . number_format($result->earnings->monthly->nett, 2) . "\n";
echo "PPh21 Tax: " . number_format($result->taxable->pph->liability->monthly, 2) . "\n";

    // init employee
    $calculator->employee->name = "Tuan A";
    $calculator->employee->ptkpStatus = "K/0";
    $calculator->employee->hasNPWP = true;
    $calculator->employee->permanentStatus = true;
    $calculator->employee->yearPeriod = 2024;
    $calculator->employee->monthPeriod = $month;

    $calculator->employee->earnings->base = 10000000;
    $calculator->employee->earnings->baseBeforeProrate = 10000000;
    $calculator->employee->components->allowances->set("Tunjangan Jabatan", 20000000);

    if (in_array($month, [2, 5])) {
        $calculator->employee->components->allowances->set("Uang Lembur", 5000000);
    }

    if ($month === 7) {
        $calculator->employee->onetime->bonus = 20000000;
    }

    if ($month === $monthPeriod) {
        $calculator->employee->onetime->holidayAllowance = 60000000;

        // Set Last Tax Period
        $calculator->employee->lastTaxPeriod->annualGross = $annually->gross;
        $calculator->employee->lastTaxPeriod->annualBonus = $annually->bonus;
        $calculator->employee->lastTaxPeriod->annualHolidayAllowance = $annually->THR;
        $calculator->employee->lastTaxPeriod->annualPPh21Paid = $annually->pph21Paid;
        $calculator->employee->lastTaxPeriod->annualJIPEmployee = 1200000; // dibayar sendiri
        $calculator->employee->lastTaxPeriod->annualZakat = 2400000; // dibayar sendiri
    }

    $result = $calculator->getCalculation();

    if ($result) {
        $items = (object) [
            'month' => date("F", mktime(0, 0, 0, $month, 1, 2024)),
            'base' => $result->earnings->base,
            'allowance' => $calculator->employee->components->allowances->sum(),
            'holidayAllowance' => $calculator->employee->onetime->holidayAllowance,
            'bonus' => $calculator->employee->onetime->bonus,
            'premi' => (object) [
                'JKK' => $result->company->jkk ?? 0,
                'JKM' => $result->company->jkm ?? 0
            ],
            'gross' => $result->earnings->monthly->gross,
            'terCategory' => $result->taxable->pph->ter->category,
            'pph21' => $result->taxable->pph->liability->monthly,
        ];

        $yearIncomes[] = $items;

        $annually->gross += $items->base + $items->allowance + $items->premi->JKK + $items->premi->JKM;
        $annually->jkk += $result->company->jkk;
        $annually->jkm += $result->company->jkm;
        $annually->bonus += $calculator->employee->onetime->bonus;
        $annually->THR += $calculator->employee->onetime->holidayAllowance;
        $annually->pph21Paid += $result->taxable->pph->liability->monthly;
    }
}

echo "yearIncomes Tuan A Pada PT.Z\n";
print_r($yearIncomes);

Features

  • PPh 21 Calculation: Comprehensive PPh 21 tax calculation for various employee types
  • BPJS Calculations: Support for BPJS Kesehatan and BPJS Ketenagakerjaan calculations
  • Multiple Employee Types: Support for permanent, non-permanent, commissioners, and other tax subjects
  • Overtime Calculation: Built-in overtime payment calculation
  • Tax Methods: Support for GROSS, NETT, and GROSS UP calculation methods
  • Annual & Monthly: Support for both monthly and annual tax calculations
  • Resignation Benefits: Calculate tax for severance pay, compensation pay, and merit pay

Supported Employee Types

  1. Permanent Employee (Pegawai Tetap)
  2. Non-Permanent Employee (Pegawai Tidak Tetap)
  3. Not Employee Sustainable (Bukan Pegawai berkesinambungan)
  4. Not Employee Sustainable with Other Income (Bukan Pegawai berkesinambungan dan Memiliki penghasilan lainnya)
  5. Not Employee Unsustainable (Bukan Pegawai tidak berkesinambungan)
  6. Other Subjects (Subject pajak lainnya seperti: Peserta Kegiatan, Pensiunan dan Bukan Pegawai)
  7. Board of Commissioners (Dewan Pengawas / Komisaris)
  8. Foreign Individual Taxpayer (Wajib Pajak Asing)

Tax Status (PTKP)

  • TK/0: Single, no dependents - Rp 54.000.000
  • TK/1: Single, 1 dependent - Rp 58.500.000
  • TK/2: Single, 2 dependents - Rp 63.000.000
  • TK/3: Single, 3 dependents - Rp 67.500.000
  • K/0: Married, no dependents - Rp 58.500.000
  • K/1: Married, 1 dependent - Rp 63.000.000
  • K/2: Married, 2 dependents - Rp 67.500.000
  • K/3: Married, 3 dependents - Rp 72.000.000

Calculation Methods

GROSS

Tax is borne by the employee. The tax amount is deducted from the employee's take-home pay.

NETT

Tax is borne by the company. The employee receives the full gross amount, and the company pays the tax separately.

GROSS UP

Tax is borne by the company and given to the employee as a tax allowance. The employee receives both the gross amount and the tax amount.

Configuration

$calculator = new PayrollCalculator();

// Configure company provisions
$calculator->Provisions->company->calculateBPJSKesehatan = true;
$calculator->Provisions->company->calculateOvertime = true;
$calculator->Provisions->company->JKK = true;
$calculator->Provisions->company->JKM = true;
$calculator->Provisions->company->JHT = true;
$calculator->Provisions->company->JIP = true;

// Configure employee
$calculator->Employee->name = "Employee Name";
$calculator->Employee->ptkpStatus = "K/0";
$calculator->Employee->hasNPWP = true;
$calculator->Employee->permanentStatus = true;
$calculator->Employee->earnings->base = 10000000;

// Set calculation method
$calculator->method = PayrollCalculator::GROSS; // or NETT, GROSS_UP

Testing

composer test

License

ISC License

Author

Rio Dwi Prabowo - riyo.s94@gmail.com

Repository

https://github.com/riod94/payroll-calculator-indonesia

riod94/payroll-calculator-indonesia 适用场景与选型建议

riod94/payroll-calculator-indonesia 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 11 月 17 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「tax」 「calculator」 「indonesia」 「payroll」 「tarif efektif rata-rata」 「TER」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 riod94/payroll-calculator-indonesia 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: ISC
  • 更新时间: 2025-11-17