PHP code example of azaharizaman / nexus-statutory
1. Go to this page and download the library: Download azaharizaman/nexus-statutory library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
azaharizaman / nexus-statutory example snippets
use Nexus\Statutory\Services\StatutoryReportManager;
use Nexus\Statutory\ValueObjects\ReportFormat;
// Generate a profit & loss report
$reportId = $reportManager->generateReport(
tenantId: 'tenant-123',
reportType: 'profit_loss',
startDate: new DateTimeImmutable('2025-01-01'),
endDate: new DateTimeImmutable('2025-12-31'),
format: ReportFormat::JSON,
options: ['
use Nexus\Statutory\ValueObjects\FilingFrequency;
FilingFrequency::MONTHLY; // 12 filings per year
FilingFrequency::QUARTERLY; // 4 filings per year
FilingFrequency::SEMI_ANNUALLY; // 2 filings per year
FilingFrequency::ANNUALLY; // 1 filing per year
FilingFrequency::BIENNIAL; // Every 2 years
FilingFrequency::ON_DEMAND; // No scheduled filing
// Get filing details
$frequency = FilingFrequency::QUARTERLY;
$frequency->getMonthInterval(); // 3
$frequency->getFilingsPerYear(); // 4
$frequency->isScheduled(); // true
namespace Nexus\Statutory\Adapters;
use Nexus\Statutory\Contracts\PayrollStatutoryInterface;
final class MalaysiaPayrollAdapter implements PayrollStatutoryInterface
{
public function calculateDeductions(
string $tenantId,
string $employeeId,
float $grossSalary,
\DateTimeImmutable $payDate,
array $employeeData = []
): array {
return [
'epf_employee' => $this->calculateEPF($grossSalary, 'employee'),
'epf_employer' => $this->calculateEPF($grossSalary, 'employer'),
'socso_employee' => $this->calculateSOCSO($grossSalary, 'employee'),
'socso_employer' => $this->calculateSOCSO($grossSalary, 'employer'),
'eis_employee' => $this->calculateEIS($grossSalary, 'employee'),
'eis_employer' => $this->calculateEIS($grossSalary, 'employer'),
'pcb' => $this->calculatePCB($grossSalary, $employeeData),
];
}
public function getCountryCode(): string
{
return 'MYS';
}
// ... implement other methods
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.