ununhunun / taxman
使用自定义或加拿大税率计算PHP销售税
dev-master
2020-09-24 18:55 UTC
Requires
- php: >=7.1
Requires (Dev)
- phpunit/phpunit: 6.5
This package is auto-updated.
Last update: 2024-09-25 04:08:07 UTC
README
使用自定义或加拿大税率计算PHP销售税
需求
需要 php >= 7.1
安装
通过composer安装包: composer require chriys/taxman
。
入门
此包允许轻松计算金额的税费。目前有两种主要方式:使用加拿大各省的税率或使用自定义税率。
使用加拿大各省的税率
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',
];
安全
如果您发现任何安全相关的问题,请通过christian.ahidjo@gmail.com联系包的开发者。
许可证
税人包是开源的,遵循MIT许可证。