PHP code example of quineworks / taxlane
1. Go to this page and download the library: Download quineworks/taxlane 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/ */
quineworks / taxlane example snippets
use TaxLane\TaxLane;
TaxLane::calculatePaye(['grossAnnualIncome' => 6_000_000])['data'];
// ['taxableIncome' => 6000000, 'payeTax' => 870000, 'monthlyTax' => 72500, ...]
use TaxLane\TaxLane;
$response = TaxLane::calculatePaye([
'grossAnnualIncome' => 6_000_000,
'annualRentPaid' => 1_200_000,
]);
$response['data'];
// ['taxableIncome' => 5760000, 'payeTax' => 826800, 'annualTax' => 826800, 'monthlyTax' => 68900,
// 'reliefs' => [...], 'bandBreakdown' => [...]]
$response['rateLimit'];
// ['limit' => 50, 'remaining' => 49, 'reset' => 1757750400]
use TaxLane\TaxLane;
use TaxLane\TaxLaneApiException;
try {
TaxLane::calculatePaye(['grossAnnualIncome' => 'not a number'], 'http://localhost:3000');
} catch (TaxLaneApiException $e) {
echo $e->getCode() . ' ' . $e->getMessage(); // 400 "grossAnnualIncome is
use TaxLane\TaxLane;
TaxLane::calculatePaye(['grossAnnualIncome' => 6_000_000, 'annualRentPaid' => 1_200_000])['data'];
// [
// 'taxableIncome' => 5760000,
// 'payeTax' => 826800,
// 'annualTax' => 826800,
// 'monthlyTax' => 68900,
// 'reliefs' => ['rentRelief' => 240000, 'pensionRelief' => 0, 'nhfRelief' => 0, 'nhisRelief' => 0, 'lifeAssurancePremiumRelief' => 0, 'minimumWageExempt' => false, 'taxableTerminationBenefit' => 0],
// 'bandBreakdown' => [
// ['from' => 800000, 'to' => 3000000, 'rate' => 0.15, 'taxInBand' => 330000],
// ['from' => 3000000, 'to' => 5760000, 'rate' => 0.18, 'taxInBand' => 496800],
// ],
// ]
use TaxLane\TaxLane;
TaxLane::calculatePayrollBatch([
'employees' => [
['grossAnnualIncome' => 6_000_000],
['grossAnnualIncome' => 900_000, 'annualRentPaid' => 400_000],
],
])['data'];
// ['results' => [['taxableIncome' => 6000000, ...], ['taxableIncome' => 820000, ...]]]
TaxLane::calculateVat(['amount' => 100_000, 'mode' => 'exclusive'])['data'];
// ['net' => 100000, 'vat' => 7500, 'gross' => 107500]
TaxLane::calculatePresumptive(['turnover' => 20_000_000])['data'];
// ['turnover' => 20000000, 'taxOwed' => 200000, 'belowFloor' => false, 'monthlySetAside' => 16666.666666666668, 'turnoverToFloor' => 0]
TaxLane::calculateDirectAssessment([
'turnover' => 10_000_000,
'allowableExpenses' => 3_000_000,
'qualifyingCapitalExpenditure' => 1_000_000,
'capitalAllowanceAssetClass' => 'plantAgriculturalEquipmentFurniture',
])['data'];
// ['turnover' => 10000000, 'allowableExpenses' => 3000000, 'capitalAllowance' => 200000, 'taxableProfit' => 6800000, 'taxOwed' => 1014000, 'effectiveRate' => 0.14911764705882352]
TaxLane::calculateCit([
'turnover' => 30_000_000,
'fixedAssets' => 100_000_000,
'isProfessionalServices' => false,
'taxableProfit' => 5_000_000,
'assessableProfit' => 8_000_000,
])['data'];
// [
// 'eligibility' => ['turnover' => 30000000, 'fixedAssets' => 100000000, 'isProfessionalServices' => false, 'turnoverEligible' => true, 'fixedAssetsEligible' => true, 'eligible' => true, 'rate' => 0],
// 'standardRate' => ['taxableProfit' => 5000000, 'annualTax' => 1500000],
// 'developmentLevy' => ['assessableProfit' => 8000000, 'developmentLevy' => 320000],
// ]
TaxLane::calculateWht(['transactionType' => 'professionalFees', 'amount' => 1_000_000, 'mode' => 'gross'])['data'];
// ['transactionType' => 'professionalFees', 'mode' => 'gross', 'amount' => 1000000, 'rate' => 0.05, 'gross' => 1000000, 'withheld' => 50000, 'net' => 950000]
TaxLane::calculateEmployerCost([
'annualBasicSalary' => 6_000_000,
'annualHousingAllowance' => 1_000_000,
'annualTransportAllowance' => 500_000,
])['data'];
// ['annualGrossPay' => 7500000, 'pensionablePay' => 7500000, 'employerPensionContribution' => 750000, ..., 'employeePaye' => [...]]
TaxLane::calculateCgt([
'taxpayerType' => 'individual',
'assetType' => 'property',
'disposalProceeds' => 50_000_000,
'costBase' => 30_000_000,
])['data'];
// ['chargeableGain' => 20000000, 'exempt' => false, 'cgtLiability' => 3630000]
TaxLane::calculateStampDuty(['instrumentType' => 'tenancy', 'amount' => 12_000_000])['data'];
// ['instrumentType' => 'tenancy', 'amount' => 12000000, 'rate' => 0.0078, 'duty' => 93600, 'exempt' => false]
TaxLane::calculateImportDuty(['fob' => 5_000_000, 'freight' => 300_000, 'insurance' => 100_000, 'band' => '20'])['data'];
// ['fob' => 5000000, 'freight' => 300000, 'insurance' => 100000, 'cif' => 5400000, 'band' => '20', 'dutyRate' => 0.2, 'duty' => 1080000, 'surcharge' => 75600, 'etls' => 27000, 'fcs' => 200000, 'vat' => 508695, 'totalLandedCost' => 7291295]
TaxLane::calculateNhfContribution(['annualBasicSalary' => 3_000_000])['data'];
// ['annualBasicSalary' => 3000000, 'annualNhfContribution' => 75000, 'monthlyNhfContribution' => 6250]
TaxLane::calculatePensionContribution(['annualBasicSalary' => 3_000_000, 'yearsToProject' => 10])['data'];
// [
// 'pensionablePay' => 3000000,
// 'employeeContribution' => 240000,
// 'employerContribution' => 300000,
// 'voluntaryContribution' => 0,
// 'totalAnnualContribution' => 540000,
// 'projection' => [['year' => 0, 'balance' => 0], ['year' => 1, 'balance' => 578000], ...],
// ]
TaxLane::calculateCapitalAllowances([
'assessableProfit' => 20_000_000,
'broughtForwardLossRelief' => 3_000_000,
'capitalAllowances' => [
'rate10' => ['qualifyingExpenditure' => 10_000_000],
'rate25' => ['qualifyingExpenditure' => 6_000_000],
],
])['data'];
// [
// 'assessableProfit' => 20000000,
// 'lossReliefApplied' => 3000000,
// 'lossReliefCarriedForward' => 0,
// 'capitalAllowanceApplied' => 2500000,
// 'capitalAllowanceCarriedForward' => 0,
// 'taxableProfit' => 14500000,
// ]
use TaxLane\TaxLane;
use TaxLane\TaxLaneApiException;
try {
TaxLane::calculatePaye(['grossAnnualIncome' => 6_000_000]);
} catch (TaxLaneApiException $e) {
if ($e->getCode() === 429 && $e->getRetryAfter() !== null) {
sleep($e->getRetryAfter());
}
}