assoconnect/php-percent
Small PHP library to represent and work with percentages in a way that pairs well with MoneyPHP, based on Frederik Bosch’s proposal. Install via Composer and use the PHPDoc-documented API to apply percent calculations safely alongside Money values.
For Executives: "This package lets us handle percentage-based pricing/fees with financial-grade accuracy—like discounts or transaction fees—without building custom logic. It integrates seamlessly with our existing MoneyPHP stack, reducing risk and speeding up feature delivery (e.g., dynamic pricing tiers). The latest release adds PHPStan support to enforce type safety, catching potential bugs early. MIT-licensed and actively maintained, it’s a low-risk way to standardize calculations across the product while improving code quality."
For Engineering:
"If we’re already using MoneyPHP, this package gives us a clean, tested way to handle percentages (e.g., 20% of $100.50 in USD/EUR) with proper rounding and currency conversion. The new PHPStan baseline ensures we catch type issues (e.g., float vs. int mismatches) before runtime. Adoption is minimal—just add the package and follow its conventions. Tradeoff: slight dependency, but saves us from debugging edge cases like 100% of $0.99 and improves maintainability."
How can I help you explore Laravel packages today?