1. Go to this page and download the library: Download sirix/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/ */
sirix / money example snippets
use Sirix\Money\Currency\DefaultCurrencyCatalog;
use Sirix\Money\MoneyFactory;
use Sirix\Money\MoneyFormatter;
$factory = new MoneyFactory(new DefaultCurrencyCatalog());
$usd = $factory->of('10.90', 'usd');
echo (new MoneyFormatter())->amount($usd); // 10.9
use Brick\Money\Currency;
use Sirix\Money\Currency\ArrayCurrencyCatalog;
use Sirix\Money\MoneyFactory;
$catalog = new ArrayCurrencyCatalog(
new Currency('POINT', 0, 'Reward points', 0),
new Currency('CREDIT', 9001, 'Store credit', 2),
);
$money = (new MoneyFactory($catalog))->of('12.50', 'CREDIT');
use Brick\Money\Currency;
use Sirix\Money\Currency\ArrayCurrencyCatalog;
use Sirix\Money\Currency\CompositeCurrencyCatalog;
use Sirix\Money\Currency\DefaultCurrencyCatalog;
use Sirix\Money\MoneyFactory;
$catalog = new CompositeCurrencyCatalog(
new DefaultCurrencyCatalog(),
new ArrayCurrencyCatalog(new Currency('POINT', 0, 'Reward points', 0)),
);
$factory = new MoneyFactory($catalog);
$points = $factory->of(100, 'POINT');
use Sirix\Money\Currency\DefaultCurrencyCatalog;
use Sirix\Money\MoneyFactory;
use Sirix\Money\MoneyFormatter;
$factory = new MoneyFactory(new DefaultCurrencyCatalog());
$formatter = new MoneyFormatter();
$usd = $factory->ofMinor('1099', 'USD');
echo $formatter->amount($usd); // 10.99
echo $formatter->minorAmount($usd); // 1099
$bitcoin = $factory->ofMinor('123456789', 'BTC');
echo $formatter->amount($bitcoin); // 1.23456789
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.