homord/tax-calculator
Composer 安装命令:
composer require homord/tax-calculator
包简介
A Laravel package to calculate taxes for multiple countries
README 文档
README
Introduction
The Laravel Tax Calculator package provides a flexible and extensible way to calculate taxes for different countries. It supports country-specific tax calculations and can be easily extended to include additional countries as needed.
Features
- Calculate annual and monthly taxes based on country-specific tax laws.
- Easily extendable to support additional countries.
- Clean and organized code using Strategy and Factory design patterns.
Installation
You can install the package via Composer:
composer require DrOmoh/tax-calculator
After installing, publish the configuration file by running:
php artisan vendor:publish --provider="YourVendorName\TaxCalculator\Providers\TaxCalculatorServiceProvider"
Usage
To calculate taxes, first, create an instance of the tax calculator for the specific country. Then, use it to calculate the annual and monthly taxes
use YourVendorName\TaxCalculator\Factories\TaxCalculatorFactory; $calculator = TaxCalculatorFactory::createCalculator('Nigeria'); // Sample data $annualEarnings = 1440000.00; $annualPen = 69120.00; $annualNhf = 9000.00; $annualTax = $calculator->calculateAnnualTax($annualEarnings, $annualPen, $annualNhf); $monthlyTax = $calculator->calculateMonthlyTax($annualTax); echo "Annual Tax: {$annualTax}\n"; echo "Monthly Tax: {$monthlyTax}\n";
Testing
To run the package's tests, execute the following command
vendor/bin/phpunit
Coding Standards
The package follows the PSR-2 coding standard. You can check the code style by running:
vendor/bin/phpcs --standard=PSR2 src/
Static Analysis
Run PHPStan to perform static analysis
vendor/bin/phpstan analyse src --level=max
Contributing
Contributions are welcome! Please submit a pull request or open an issue on GitHub.
Steps to Contribute
- Fork the repository.
- Create a new branch (git checkout -b feature/new-country-tax-calculator).
- Make your changes.
- Commit your changes (git commit -m 'Add tax calculator for NewCountry').
- Push to the branch (git push origin feature/new-country-tax-calculator).
- Open a pull request.
License This package is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-12