1. Go to this page and download the library: Download crmleaf/bonus-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/ */
crmleaf / bonus-calculator example snippets
use Crmleaf\Payroll\Calculators\BonusCalculator;
use Crmleaf\Payroll\Money;
$result = (new BonusCalculator())->calculate(
monthlyWages: Money::fromRupees(18_000),
bonusRate: 8.33,
);
echo $result->explain(); // the formula with the real operands in it
echo $result->workings(); // every step, one per line, with its citation
print_r($result->toArray()); // snake_case, ready for JSON
use Crmleaf\Payroll\Calculators\BonusCalculator;
public function show(BonusCalculator $calculator)
{
return $calculator->calculate(
monthlyWages: Money::fromRupees(18_000),
bonusRate: 8.33,
)->toArray();
}