PHP code example of faridbabayev / cbar-currency

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

    

faridbabayev / cbar-currency example snippets


FaridBabayev\CBARCurrency\CBARCurrencyServiceProvider::class

'CBAR' => \FaridBabayev\CBARCurrency\Facades\CBAR::class

use FaridBabayev\CBARCurrency\Facades\CBAR;

$currencies = CBAR::currencies(); // this will fetch currencies for current date
$currencies = CBAR::from("18.02.2022")->currencies(); // this will fetch currencies for 18.02.2022

use FaridBabayev\CBARCurrency\Facades\CBAR;

$currencies = CBAR::currencies(); // this will fetch currencies for current date
$currencies = CBAR::from("18.02.2022")->currencies(); // this will fetch currencies for 18.02.2022
 artisan migrate

use FaridBabayev\CBARCurrency\Facades\CBAR;

$currencies = CBAR::driver('database')->currencies(); // this will fetch currencies for current date
$currencies = CBAR::driver('database')->from("18.02.2022")->currencies(); // this will fetch currencies for 18.02.2022

use FaridBabayev\CBARCurrency\Facades\CBAR;

$currencies = CBAR::driver('file')->currencies(); // this will fetch currencies for current date
$currencies = CBAR::driver('file')->from("18.02.2022")->currencies(); // this will fetch currencies for 18.02.2022

$currencies = CBAR::currencies();
$currencies->toAZN('USD')->convert(); // returns AZN equivalent of 1.00 USD with today's currencies
$currencies->toAZN('USD')->convert(25.53); // returns AZN equivalent of 25.53 USD with today's currencies

$currencies = CBAR::currencies();
$currencies->fromAZN('USD')->convert(); //  returns USD equivalent of 1.00 AZN with today's currencies
$currencies->fromAZN('USD')->convert(25.53); //  returns USD equivalent of 25.53 AZN with today's currencies
shell
php artisan vendor:publish --provider="FaridBabayev\CBARCurrency\CBARCurrencyServiceProvider"
file