Copyright (c) 2021-current Bit 64 Solutions Pty Ltd (bit64.co)
This component provides a tax calculator microservice specific to the South African Revenue Services (SARS) for PHP projects.
Installation via Composer
$ composer require bit64/sars
Instantiate the API class
use Bit64\SARS\Api;
$api = new Api();
Get the income tax calculator
$incomeTax = $api->IncomeTax();
Default age is 30 years old
$grossMonthly = 25000;
$paye = $incomeTax->calculateMonthlyTax($grossMonthly);
echo sprintf('R%0.2f', $paye);
// Output R3749.17
Specify age and context date
$grossWeekly = 12000;
$age = 68;
$contextDate = '2021-05-30';
$paye = $incomeTax->calculateWeeklyTax($grossWeekly, $age, $contextDate);
echo sprintf('R%0.2f', $paye);
// Output R2751.23