PHP code example of mrzard / open-exchange-rates-bundle

1. Go to this page and download the library: Download mrzard/open-exchange-rates-bundle 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/ */

    

mrzard / open-exchange-rates-bundle example snippets

 php
return array(
   // ...
   new Mrzard\OpenExchangeRatesBundle\OpenExchangeRatesBundle(),
   // ...
);
 php
/**
 * Get the latest exchange rates
 *
 * @param array  $symbols Currency codes to get the rates for. Default all
 * @param string $base    Base currency, default NULL (gets it from config)
 *
 * @return array
 */
public function getLatest($symbols = array, $base = null)
{
}
 php
/**
 * Gets a list of all available currencies
 *
 * @return array with keys = ISO codes, content = Currency Name
 */
public function getCurrencies()
{
}
 php
/**
 * Get historical data
 *
 * @param \DateTime $date
 */
public function getHistorical(\DateTime $date)
{
}
 php
$openExchangeRatesService->getLatest(['EUR', 'USD', 'COP']);
 php
$openExchangeRatesService->convert(10, 'USD', 'EUR');