Currency Providers
Basic Usage
Loop over Currencies
<?php
// @var CurrencyInterface $currency
foreach ($provider->getCurrencies() as $currency) {
// Do something with each currency
}Check if Provider has a Currency
// Check to see if the provider has the currency you are looking for
// @var bool $hasCurrency
$hasCurrency = $provider->hasCurrency('USD');
$hasCurrency = $provider->hasCurrency(Currency::USD());Getting Currency from the Provider
// You can get a Currency like this. If the Currency does not exist
// it will throw an exception.
// @var CurrencyInterface $currency
$currency = $provider->getCurrency('USD');
$code = $currency->getCurrencyCode(); // "USD"
$numCode = $currency->getNumericCode(); // 840
$minorUnit = $currency->getMinorUnit(); // 2Currency Providers
CurrencyProvider
XCurrencyProvider
ChainCurrencyProvider
Last updated