currency-formator Its a small utility to convert Indian currency to words format

  1. CONFIGURATION:
  2. Usage
  3. Resources

Its a small utility to convert Indian currency to words format

CONFIGURATION:

Config - main.php

'components' => array(
    'currency_formator' => array(
        'class' => 'ext.yii-extension-INRCurrencyFormator.INRCurrencyFormator',
        'params' => array(
            'postfix'  => 'only',
            'currency' => '₹'
        )
    ),
);

Usage

$converter = Yii::app()->currency_formator;
echo $converter->toWords('12');
// Twelve Rs. only

echo $converter->toWords('123');
// One Hundred and Twenty-Three Rs. only

echo $converter->toWords('1234');
// One Thousand Two Hundred and Thirty-Four Rs. only

echo $converter->toWords('12345');
// Twelve Thousand Three Hundred and Fourty-Five Rs. only

echo $converter->toWords('123456');
// One Lakh Twenty-Three Thousand Four Hundred and Fifty-Six Rs. only

echo $converter->toWords('12345600');
// One Crore Twenty-Three Lakh Fourty-Five Thousand Six Hundred Rs. only
Currency symbol can be changed like this

You can set in config for global configuration

$converter = Yii::app()->currency_formator;
$converter->currency = '₹';
echo $converter->toWords('12');
// Twelve ₹ only

Postfix text can be changed like this

You can set in config for global configuration

$converter = Yii::app()->currency_formator;
$converter->postfix = 'payable';
echo $converter->toWords('12');
// Twelve ₹ payable
Postfix text and currency can be disabled like this
$converter = Yii::app()->currency_formator;
echo $converter->toWords('12','no_postfixtext');
// Twelve

Resources

0 0
2 followers
158 downloads
Yii Version: all
License: PHP-3.0
Category: User Interface
Developed by: Shardiwal
Created on: May 7, 2015
Last updated: 9 years ago

Downloads

show all

Related Extensions