PHP Sales Tax calculator using custom or Canadian rates
Requires php >= 7.1
Install the packages via composer: composer require chriys/taxman
.
This package allows to easily calculate taxes on an amount. Currently two main ways are available: using rates of Canadian provinces or using custom rates.
Taxes::calculate('10.00', 'alberta');
// expected result
[
'sub_total' => '10.00',
'taxes_details' => [
'gst' => '0.5',
'pst' => '0.8',
],
'taxes' => '1.3',
'total' => '11.3',
];
Taxes::calculate('45', [1, 2, 3]);
// expected result
[
'sub_total' => '45',
'taxes_details' => [
0 => '0.45',
1 => '0.9',
2 => '1.35',
],
'taxes' => '2.7',
'total' => '47.7',
];
If you discover any security related issues, please contact the package developer at christian.ahidjo@gmail.com
The Taxman package is open-sourced licensed under the MIT License.