Download the PHP package tawwfik/zakat-calculator without Composer
On this page you can find all versions of the php package tawwfik/zakat-calculator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download tawwfik/zakat-calculator
More information about tawwfik/zakat-calculator
Files in tawwfik/zakat-calculator
Package zakat-calculator
Short Description A Laravel package for calculating zakat on money, gold, and silver.
License MIT
Homepage https://github.com/tawwfik/Zakat-Calculator
Informations about the package zakat-calculator
Zakat Calculator for Laravel
A comprehensive Laravel package for calculating zakat on various assets including money, gold, silver, business assets, and agricultural products. This package follows Islamic principles and supports multiple calculation methods.
Features
- Calculate zakat on multiple asset types:
- Cash and bank balances
- Gold (supports multiple karats)
- Silver
- Business assets (inventory, receivables, cash)
- Agricultural products
- Support for different calculation methods (Hanafi, Shafi'i, Maliki, Hanbali)
- Configurable nisab thresholds
- Real-time gold and silver price integration
- Detailed calculation breakdowns
- Caching support for better performance
- Comprehensive validation and error handling
Installation
You can install the package via composer:
The package will automatically register its service provider.
Publishing Configuration
You can publish the configuration file using:
This will create a config/zakat.php file in your config directory.
Usage
Basic Usage
Available Methods
Asset Setting Methods
setCash(float $cash): Set cash amountsetGoldItems(array $goldItems): Set gold items with weight and karatsetSilverWeight(float $silverWeight): Set silver weightsetGoldPrice(float $goldPrice): Set gold price per gramsetSilverPrice(float $silverPrice): Set silver price per gramsetBusinessAssets(array $assets): Set business assetssetAgriculturalProducts(array $products): Set agricultural products
Configuration Methods
setCalculationMethod(string $method): Set calculation method (hanafi, shafi, maliki, hanbali)setNisabThreshold(float $threshold): Set custom nisab thresholdsetCacheEnabled(bool $enabled): Enable/disable cachingsetCacheTTL(int $ttl): Set cache time-to-live in seconds
Calculation Methods
calculate(): Calculate total zakatcalculateCashZakat(): Calculate zakat on cash onlycalculateGoldZakat(): Calculate zakat on gold onlycalculateSilverZakat(): Calculate zakat on silver onlycalculateBusinessZakat(): Calculate zakat on business assets onlycalculateAgriculturalZakat(): Calculate zakat on agricultural products only
Calculation Result
The calculate() method returns an array with the following information:
Configuration
After publishing the configuration file, you can customize the following settings in config/zakat.php:
Default Prices
Nisab Thresholds
Currency Settings
Weight Unit
Calculation Precision
Supported Gold Karats
Cache Settings
Calculation Methods
Business Assets
Agricultural Products
Advanced Usage Examples
Calculating Zakat for Gold Only
Calculating Business Zakat
Calculating Agricultural Zakat
Using Different Calculation Methods
Error Handling
The package throws specific exceptions for different error cases:
InvalidInputException: Thrown for invalid input valuesInvalidKaratException: Thrown for unsupported gold karatsConfigurationException: Thrown for missing or invalid configuration
Example error handling:
Testing
Run the tests using:
Contributing
Please see CONTRIBUTING.md for details.
Security
If you discover any security related issues, please email [email protected] instead of using the issue tracker.
License
The MIT License (MIT). Please see License File for more information.
All versions of zakat-calculator with dependencies
illuminate/support Version ^9.0|^10.0|^11.0
illuminate/config Version ^9.0|^10.0|^11.0
illuminate/cache Version ^9.0|^10.0|^11.0