Search code examples
apilaravel-6numberformatter

How to use NumberFormatter in laravel - 6


How to use "NumberFormatter" in Laravel function?

My Code is ( I need to covert number to Word ) Eg: 999 is like "Nine hundred ninety-nine"

$digit = new NumberFormatter("en", NumberFormatter::SPELLOUT); 
echo $digit->format(1000);

It gives Error like:

"message": "Class 'Modules\\Receipts\\Http\\Controllers\\NumberFormatter' not found",
"exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError",

How to resolve this problem?


Solution

  • sudo apt-get install php-intl
    service apache2 restart