PHP code example of offline-agency / laravel-bank-of-italy

1. Go to this page and download the library: Download offline-agency/laravel-bank-of-italy 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/ */

    

offline-agency / laravel-bank-of-italy example snippets


$exchange_rate = new ExchangeRate();
$exchange_rates = $exchange_rate->getExchangeRates();

foreach ($exchange_rates->getItems() as $exchange_rate) {
    dd($exchange_rate); 
    /*
     OfflineAgency\LaravelBankOfItaly\Entities\ExchangeRate\ExchangeRate {
        +currency: "Dollaro USA"
        +currencyIsoCode: "USD"
        +currencyUicCode: "001"
        +rate: "1.0724"
        +rateConvention: "Quantità di valuta estera per 1 Euro"
        +referenceDate: "Y-m-d"
     }
     */
}

$exchange_rate = new ExchangeRate();
$response = $exchange_rate->getExchangeRates([
    'lang' => 'en', // Default: it
    'baseCurrencyIsoCode' => 'EUR', // Default: USD
    'currencyIsoCode' => 'ITL', // Default: EUR (accepted values: EUR, USD, ITL)
    'startDate' => '01-01-2000', // Default: Carbon::now()->subYear() (format: Y-m-d)
    'endDate' => '01-01-2000' // Default: Carbon::now() (format: Y-m-d)
]);
bash
php artisan vendor:publish --provider="OfflineAgency\LaravelBankOfItaly\LaravelBankOfItalyServiceProvider"