PHP code example of mibo / currencies

1. Go to this page and download the library: Download mibo/currencies library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mibo / currencies example snippets


$factory = new \MiBo\Engine\Utils\Currencies\ISO\ISOCurrencyProvider();

// Get By Alphabetic Code ("EUR")
$currency = $factory->findByAlphabeticalCode("EUR");

// Get By Numerical Code ("012")
$currency = $factory->findByNumericalCode("123");

// Get By Country Name
// Returns an array of currencies
$currencies = $factory->findByCountry("CZECHIA");

$factory->getLoader()->setResources(\MiBo\Engine\Utils\Currencies\ISO\ISOListLoader::SOURCE_LOCAL); 

$currency = new \MiBo\Engine\Utils\Currencies\ISO\ISOCurrency(/*...*/);

$currency->getAlphabeticalCode(); // "EUR"
$currency->getNumericalCode(); // "978"
$currency->getName(); // "Euro"
$currency->getMinorUnitRate(); // 2|null