Do you like this library? Leave a ★ or run composer global require symfony/thanks && composer thanks
to say thank you to all libraries you use in your current project, this included!
Represents a monetary value.
Extends moneyphp/money.
- How to use the Doctrine's type
money
- How to use the Twig extensions
- How to use the Symfony Form type
// vendor/moneyphp/money/src/Money.php
/**
* @param integer $amount
* @param \Money\Currency|string $currency
* @throws \Money\InvalidArgumentException
*/
public function __construct($amount, $currency)
See the working example: examples/Currency.php.
use SerendipityHQ\Component\ValueObjects\Money\Money;
$values = [
Money::HUMAN_AMOUNT => 300,
Money::CURRENCY => 'EUR'
];
$money = new Money($values);
dump($money);
This object is a wrapper for the Money object by PHPMoney.
As the original object is a final
class, it is not possible to extend it.
So this ValueObjects\Money object simply wraps an \Money\Money
object.
Do you like this library? Leave a ★ or run composer global require symfony/thanks && composer thanks
to say thank you to all libraries you use in your current project, this included!