I am happy to say that MoneyPHP 4.2.0 incorporates my Teller contribution for handling monetary math in legacy codebases.

Legacy codebases often use float math for monetary calculations, which leads to problems with fractions-of-pennies in monetary amounts. The proper solution is to introduce a Money object, and use Money objects in place of float math. However, doing so can be quite a hardship, especially when the float values need to be moved to and from database storage. Intercepting and converting the float values (often represented by strings) into Money objects on their way out of the database, then reconverting them to their original format on their way back to the database, can be very difficult and time-consuming.

To help ease the transition from float math to Money objects, use a Teller instance to replace float math for monetary calculations in place. Without Teller, your math might look like this ...

$price = 234.56;
$discount = 0.05;
$discountAmount = $price * $discount;
// => 11.728

... and you end up with an extraneous $0.008. Whereas with Teller, you can replace the money math in place, without needing to create Money objects:

// create a Teller, perhaps in a DI container ...
$teller = \Money\Teller::USD();

// ... then use it for monetary math:
$price = 234.56;
$discount = 0.05;
$discountAmount = $teller->multiply($price, $discount);
// => '11.73'

The main drawback is that you cannot use two different currencies with the Teller; you can use only one.

Teller supports the full range of Money operations. You can read the documentation for it here.

Are you stuck with a legacy PHP application? You should buy my book because it gives you a step-by-step guide to improving you codebase, all while keeping it running the whole time.