PHP code example of tnkemdilim / money-to-words-converter

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

    

tnkemdilim / money-to-words-converter example snippets


composer 

"    "tnkemdilim/money-to-words-converter": "^2"
}

use TNkemdilim\MoneyToWords\Converter;

// Nigerian currency : naira & kobo
$converter = new Converter("naira", "kobo");
echo ($converter->convert(374));
echo ($converter->convert(23.45));
echo ($converter->convert(748247284782));
echo ($converter->convert(748247284782.34));
echo ($converter->convert('34'));
echo ($converter->convert('2345.34'));
echo ($converter->convert('3453345'));

use TNkemdilim\MoneyToWords\Converter;
use TNkemdilim\MoneyToWords\Languages as Language;

$converter = new Converter("naira", "kobo", Language::FRENCH);

echo ($converter->convert(23.45));
echo ($converter->convert("748247284782"));

// Chinese numeric system
$money = "八百七十二万七千八百二十四";

// Example 1
$converter = new Converter("yen", "sen");
echo ($converter->convert($money));

// Example 2: but convert money value to french
$frenchConverter = new Converter("yen", "sen", Language::FRENCH);
echo ($frenchConverter->convert("八百七十二万七千八百二十四"));

//  Dollars & Cents
$converter->setCurrency("dollar", "cents");
echo ($converter->convert(234.34)); // two hundred and thirty-four dollars, thirty-four cents only.

// Pounds & Pence
$converter->setCurrency("pounds", "pence");
echo ($converter->convert('23.3')); // twenty three pounds, 3 pence only.

use TNkemdilim\MoneyToWords\Languages as Language;

$converter->setLanguage(Language::LATIN);
$converter->setLanguage(Language::SWAHILI);
$converter->setLanguage(Language::GREEK);