PHP code example of cleaniquecoders / money-wrapper

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

    

cleaniquecoders / money-wrapper example snippets


CleaniqueCoders\MoneyWrapper\MoneyWrapperServiceProvider::class,

'MoneyWrapper' => CleaniqueCoders\MoneyWrapper\MoneyWrapperFacade::class,

$money = money(); // by default it will use MY
$moneyUsd = money('US'); // pass the country code - ISO Alpha 2

echo money()->toHuman(100); // RM 1.00, useful for human readability
echo money()->toCommon(100); // 1.00
echo money()->toMachine('1.00'); // 100, always store in database as integer. 

$fixedExchange = [
    'MYR' => [
        'USD' => 3.87,
    ],
];
echo money()->convertFixedRate($fixedExchange, 100, 'USD')->getAmount(); // 387

[
	'MYR' => [
		'swift_code' => 'MYR',
		'symbol' => 'RM'
	]
]