votemike/money
最新稳定版本:1.2.0
Composer 安装命令:
composer require votemike/money
包简介
A class for dealing with Money (a combination of a value and a currency)
关键字:
README 文档
README
Pass in an amount and currency to the Money object to create an immutable object. Perform actions with the object. Deals with different units/rounding of different currencies. Formats money for display Please use GitHub to raise any issues and suggest any improvements.
Install
Via Composer
$ composer require votemike/money
Usage
$money = new Money(99.999999, 'GBP');
$add = $money->add(new Money(20, 'GBP'));
$sub = $money->sub(new Money(20, 'GBP'));
$multiply = $money->multiply(3);
$divide = $money->divide(3);
$abs = $money->abs();
$inv = $money->inv();
$percentage = $money->percentage(20);
$round = $money->round();
list($first, $second, $third) = $money->split(20, 33.33);
$money = new Money(99.50, 'JPY');
$money->format(); //¥100
$money->formatWithSign(); //+¥100
$money->getAmount(); //99.50
$money->getCurrency(); //JPY
$money->getRoundedAmount(); //100
$money = new Money(9500, 'USD');
$money->formatShorthand(); //$10k
$money = new Money(-9.500, 'USD');
$money->formatForAccounting(); //(9.50)
Credits
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 25.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-06-10