1. Go to this page and download the library: Download dgtlinf/salary-calculator 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/ */
dgtlinf / salary-calculator example snippets
use Dgtlinf\SalaryCalculator\Facades\SalaryCalculator;
use Dgtlinf\SalaryCalculator\Models\{
SalaryContext,
EmployeeProfile,
EmployerProfile
};
$employee = new EmployeeProfile(
firstName: 'Milan',
lastName: 'Jovanović',
address: 'Kralja Petra 10, Beograd',
idNumber: '0101990123456',
bankAccount: '160-123456789-01',
position: 'Software Engineer'
);
$employer = new EmployerProfile(
name: 'Digital Infinity DOO',
taxId: '110217311',
registrationNumber: '21318507',
address: 'Bulevar Kralja Petra I 89, Novi Sad',
bankName: 'Raiffeisen Bank',
bankAccount: '265-0001234567890-00'
);
$context = new SalaryContext(
2025,
9,
'RS',
vacationDays: 0,
sickDays: 0,
sickLeaveFullPay: false,
yearsInService: 2,
avgHourlyRateLast12Months: null,
employee: $employee,
employer: $employer
);
// Create the calculator
$calc = SalaryCalculator::for($context);
// Run calculation from gross
$result = $calc->fromGross(790729.64);
// Optionally validate output structure before use
$calc->validateOutput($result);
return response()->json($result);