Download the PHP package vinaikopp/currency-info without Composer
On this page you can find all versions of the php package vinaikopp/currency-info. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vinaikopp/currency-info
More information about vinaikopp/currency-info
Files in vinaikopp/currency-info
Package currency-info
Short Description Provide basic information to display a currency amount
License BSD-3-Clause
Informations about the package currency-info
Currency Info
This repository offers an easy way to get data required to display money values in a given currency:
- Fraction Digits (e.g. 2 for currencies with 100 subunits like USD)
- Rounding (e.g. 0.05 for currencies like CHF)
- International Symbol (e.g. € for EUR)
- Native Symbol (e.g. $ for USD)
To look up the information the (ISO 4217) three letter currency code, e.g. DKK or EUR).
Background
Sometimes a currency package that provides all things about currency is overkill. I might just want to render a monetary value.
PHP can natively nicely format currency values, but it doesn't know about the default fraction digits for example.
This is what this package can be used for. It does not provide any functionality in regards to conversion or division or such.
All this package does is provide information about a given currency.
Installation
Install using composer:
Or add it manually to the composer.json file:
Usage
For example, to display a money value with the default number of fraction digits, something like this could be used:
Example using static methods
If you use an Dependency Injection Container and would like an instance you can inject,
you can use \VinaiKopp\CurrencyInfo\CurrencyInfo
.
Example using a currency info instance
What it is not
This package does not offer capabilities to do money calculations or currency conversions. If you need that, I suggest using mathiasverraes/money.
Continuous Integration
Service | Build Status | Coverage | Score |
---|---|---|---|
Travis | |||
Scrutinizer | ![]() |
![]() |
![]() |
Where does the data come from?
The map is based on the LocalePlanet Currency Map.
Thanks for their epic efforts!!