PHP code example of unirate / statamic

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

    

unirate / statamic example snippets


use UniRate\Statamic\UniRateClient;

$client = app(UniRateClient::class);

$rate       = $client->getRate('USD', 'EUR');       // 0.92
$allRates   = $client->getRate('USD');              // ['EUR' => 0.92, ...]
$converted  = $client->convert('EUR', 100, 'USD');  // 92.5
$currencies = $client->getSupportedCurrencies();    // ['USD', 'EUR', ...]
$vat        = $client->getVatRates('DE');           // ['country_name' => 'Germany', 'vat_rate' => 19.0]
bash
php artisan vendor:publish --tag=unirate-config
antlers
{{ unirate:currencies }}
    <option value="{{ code }}">{{ code }}</option>
{{ /unirate:currencies }}