PHP code example of sungmee / laravel-fx

1. Go to this page and download the library: Download sungmee/laravel-fx 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/ */

    

sungmee / laravel-fx example snippets


'providers' => [
    Sungmee\LaraFX\ServiceProvider::class,
]

'aliases' => [
    'FX' => Sungmee\LaraFX\Facade::class,
]

// 查询汇率
$base    = 'USD';
$symbols = 'CNY,JPY';
$minutes = 60;
\FX::atm($base, $symbols, $minutes);

// 货币兑换
$money = 100;
\FX::usd2cny(100);
\FX::usd2jpy(100);
...

// 更改默认变量
\FX::setBase('CNY');
\FX::setSymbols('USD');
...

// 更改默认查询网关
\FX::gateway('Fixer')->atm();