xgrz / money
Money helper for Laravel
Installs: 71
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/xgrz/money
Requires
- php: ^8.1
- illuminate/support: ^10.0 || ^11.0 || ^12.0
Requires (Dev)
- larastan/larastan: ^2.0 || ^3.0
- orchestra/testbench: ^8.0 || ^9.0 || ^10.0
- phpstan/phpstan: ^1.0 || ^2.0
- phpunit/phpunit: ^10.0 || ^11.0
README
Money formatter/calculator for Laravel
Money is small package for money format for Laravel. It works with Laravel 10, 11 and 12 (PHP 8.1-8.4)
Installation
composer require xgrz/money
Example usage
use XGrz\Money\Money;
try {
    $money = Money::from(1234.567, precision: 2)
        ->currency('€', beforeAmount: true)
        ->decimalSeparator('.')
        ->thousandsSeparator(',')
        ->shouldDisplayZero(false);
        echo $money->format(); // €1,234.57
    } catch (MoneyValidationException $e) {
        echo "Error: " . $e->getMessage();
    }