sebastian / money-intl-formatter
Implementation of SebastianBergmann\Money\Formatter that uses PHP's built-in NumberFormatter
Installs: 1 296
Dependents: 0
Suggesters: 1
Security: 0
Stars: 12
Watchers: 3
Forks: 1
Open Issues: 1
Requires
- php: >=5.6
- ext-intl: *
- sebastian/money: ~2.0
This package is not auto-updated.
Last update: 2016-04-06 00:47:27 UTC
README
Implementation of SebastianBergmann\Money\Formatter
that uses PHP's built-in NumberFormatter.
Installation
Simply add a dependency on sebastian/money-intl-formatter
to your project's composer.json
file if you use Composer to manage the dependencies of your project.
Here is a minimal example of a composer.json
file:
{
"require": {
"sebastian/money-intl-formatter": "~1.0"
}
}
Usage Examples
Formatting a Money object using PHP's built-in NumberFormatteruse SebastianBergmann\Money\Currency; use SebastianBergmann\Money\Money; use SebastianBergmann\Money\IntlFormatter; // Create Money object that represents 1 EUR $m = new Money(100, new Currency('EUR')); // Format a Money object using PHP's built-in NumberFormatter (German locale) $f = IntlFormatter::fromLocale('de_DE'); print $f->format($m);
The code above produces the output shown below:
1,00 €