Laravel convert amount to word/digit | Convert number to word/digit









Requirements

  • PHP ^7.2
  • Laravel ^5.8|^6.0

Install

Via composer:




$ composer require hnhdigital-os/laravel-number-converter




Enable an alias by editing config/app.php:


'aliases' => [
    ...
    'NumConvert' => 'HnhDigital\LaravelNumberConverter\Facade',
    ...
]

Convert to word

Supported number range -2147483647 to 2147483647.




echo NumConvert::word(1);
echo number_to_word(1);
 
one

Convert to roman

Supported number range 1 to 3999.




echo NumConvert::roman(1);
echo number_to_roman(1);
 
I

Ordinal (word + suffix)

Supported number range 1 to 2147483647.




echo NumConvert::wordOrdinal(1);
echo number_to_word_ordinal(1);
 
first

Ordinal (number + suffix)

Supported number range 1 to 2147483647.




echo NumConvert::numberOrdinal(1);
echo number_with_ordinal_suffix(1);
 
1st
 
 

Laravel 5.7 

Install

Via composer:

$ composer require hnhdigital-os/laravel-number-converter

Enable an alias by editing config/app.php:

'aliases' => [ ... 'NumConvert' => 'HnhDigital\LaravelNumberConverter\Facade', ... ]

Convert to word

Supported number range -2147483647 to 2147483647.

echo NumConvert::word(1); echo number_to_word(1); one
 


www.basabaribd.com

No comments

Powered by Blogger.