Questions tagged [money-php]

PHP library implementing Martin Fowler's Money pattern.

PHP library implementing Martin Fowler's Money pattern. https://github.com/moneyphp/money

6 questions
2
votes
1 answer

Money PHP - Loseless way to Persist Money Object in Database

Am refering to moneyphp/money library which I plan to use it in one of our projects for dealing with currencies. The Documentation is great except it does not touch how to persist in the database. It speaks about encoding money object to JSON but…
Stefano Mtangoo
  • 6,017
  • 6
  • 47
  • 93
1
vote
1 answer

Calculating tax using moneyphp

I am using the moneyphp/money class to store monetary values. However when calculating the tax owed I have an issue where the calculated tax is a decimal and the library is looking for an integerish value. Example: $invoiceTotal = new Money("155"…
0
votes
1 answer

How to compare amounts with PHP library brick/money

I decided to use the PHP library brick/money for currency calculations, since it's too imprecise to use floats, and it's annoying to convert amounts to cents so you use integers only, and to make easier dealing with rounding. I didn't go with the…
El Gucs
  • 897
  • 9
  • 18
0
votes
1 answer

get dollars from cents using moneyphp

How can I use moneyphp/money to get the money in dollars from cents? I am storing price as cents in my database, and lets say I have this accessor in a laravel model public function getPriceAttribute($price) { $fiver =…
rook99
  • 1,034
  • 10
  • 34
0
votes
1 answer

TbbcMoneyBundle ratio_provider: does not work now

I'm working with: https://github.com/TheBigBrainsCompany/TbbcMoneyBundle When I launch it with: bin/console tbbc:money:ratio-fetch I see an error in Crawler.php line 565: The current node list is empty. tbbc_money: currencies: ["UAH", "USD",…
-1
votes
1 answer

Round all calculations to the nearest number

I am dealing with money and would love to round the numbers to the lowest payable amount on market. Let say I have a calculation resulting in: 25,467.56 5333.65 532 60 54 In the market the lowest amount payable is 50, so somehow these numbers have…
Stefano Mtangoo
  • 6,017
  • 6
  • 47
  • 93