PHP code example of rossmitchell / xfi-currency

1. Go to this page and download the library: Download rossmitchell/xfi-currency 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/ */

    

rossmitchell / xfi-currency example snippets




use Money\Currency;
use Money\Money;
use RossMitchell\XfiCurrency\XFI\XFICurrency;

$xfiMoney = new Money('12345', new Currency(XFICurrency::CODE));



use Money\Currency;
use Money\Money;
use RossMitchell\XfiCurrency\Converter;
use RossMitchell\XfiCurrency\Provider;
use RossMitchell\XfiCurrency\XFI\XFICurrency;

$gbp = new Money('123', new Currency('GBP'));
$xfi = new Money('123', new Currency(XFICurrency::CODE));

$converter = new Converter(new Provider());
$convertedXfi = $converter->toXFI($gbp);
$convertedGbp = $converter->toGbp($xfi);



use Money\Currency;
use Money\Money;
use RossMitchell\XfiCurrency\Formatter;
use RossMitchell\XfiCurrency\Provider;
use RossMitchell\XfiCurrency\XFI\XFICurrency;

$gbp = new Money('123', new Currency('GBP'));
$xfi = new Money('123', new Currency(XFICurrency::CODE));

$formatter = new Formatter(new Provider());
echo $formatter->formatMoney($xfi);
echo $formatter->formatMoney($gbp);