A powerful and modern PHP library for performing various percentage calculations.
Report a Bug · New Pull Request
If you find the Percentage Calculator library helpful or interesting, consider giving it a star! ⭐️
Your star helps us grow and motivates us to continue improving the library. It also makes it easier for others to discover and benefit from this project.
- Login to Your GitHub Account: You need to have a GitHub account.
- Visit the Repository: Go to the Percentage Calculator Repository.
- Click the Star Button: On the top-right corner of the page, you'll find a "Star" button. Click on it!
That's it! Thank you for your support! 🚀
- Calculate the percentage of a number.
- Calculate the percentage change between two numbers.
- Increase a number by a percentage.
- Decrease a number by a percentage.
You can install this library via Composer. Run the following command:
composer require ramazancetinkaya/percentage-calculator
require_once 'vendor/autoload.php';
use ramazancetinkaya\PercentageCalculator;
$calculator = new PercentageCalculator();
try {
// Calculate percentage
$result = $calculator->calculatePercentage(250, 20);
echo "20% of 250 is: " . $result . "\n";
// Calculate percentage change
$change = $calculator->calculatePercentageChange(100, 75);
echo "Percentage change from 100 to 75 is: " . $change . "%\n";
// Increase by percentage
$increase = $calculator->increaseByPercentage(50, 25);
echo "50 increased by 25% is: " . $increase . "\n";
// Decrease by percentage
$decrease = $calculator->decreaseByPercentage(80, 10);
echo "80 decreased by 10% is: " . $decrease . "\n";
} catch (InvalidArgumentException $e) {
echo "Error: " . $e->getMessage();
}
Contributions are welcome! Please fork the repository and create a pull request.
This library was made possible by the following awesome contributors:
- Ramazan Çetinkaya - @ramazancetinkaya
- Lead Developer
Special thanks to the following resources:
- PHP Documentation - Valuable information on PHP programming language.
- Composer - Dependency manager for PHP.
If you've contributed to this project and your name is not listed, please let us know, and we'll add you!
Thank you to everyone who has helped make this project better!
This project is licensed under the MIT License. For more details, see the LICENSE file.