PHP code example of restuniverse / currency

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

    

restuniverse / currency example snippets


'providers' => [

    \RestUniverse\Currency\CurrencyServiceProvider::class,

]

'aliases' => [

    'Currency' => \RestUniverse\Currency\Facades\Currency::class,

];

currency($amount, $from = null, $to = null, $format = true)

echo currency(12.00);               // Will format the amount using the user selected currency
echo currency(12.00, 'USD', 'EUR'); // Will format the amount from the default currency to EUR
bash
php artisan vendor:publish --provider="RestUniverse\Currency\CurrencyServiceProvider" --tag=config
bash
php artisan vendor:publish --provider="RestUniverse\Currency\CurrencyServiceProvider" --tag=migrations
bash
$ php artisan migrate
bash
php artisan currency:hydrate