1. Go to this page and download the library: Download muvon/kiss-money 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/ */
muvon / kiss-money example snippets
use Muvon\KISS\Money;
Money::init([
'USD' => [
'fraction' => 2
]
]);
$Money = Money::fromAmount('0.01', 'USD');
// If we want to create from minor amount
// $Money = Money::fromMinor('1', 'USD');
// Get amount
var_dump($Money->getAmount());
// Get minor amount aka Value
var_dump($Money->getValue());
$list = Money::fromAmounts(['1.01', '2.03'], 'USD');
// Dumps array of Money objects created from amounts
var_dump($list);
// Dumps single object from amount
var_dump(Money::fromAmount('1.01', 'USD'));
// You can do almost the same just from minor amount
// Using method fromValue and fromValues
// But passing minor amounts to them