DEV Community

Cover image for How to Solve 'Class NumberFormatter not found' in Laravel
saim
saim

Posted on • Originally published at larainfo.com

How to Solve 'Class NumberFormatter not found' in Laravel

The error Class 'NumberFormatter' not found in Laravel typically occurs when the intl extension is not installed or enabled in your PHP environment. The NumberFormatter class is part of the intl (Internationalization) extension.
Class NumberFormatter not found'

Check PHP Extension

Make sure that the intl extension is installed and enabled.
For Ubuntu/Debian:



sudo apt-get install php-intl


Enter fullscreen mode Exit fullscreen mode

For CentOS/RHEL:



sudo yum install php-intl


Enter fullscreen mode Exit fullscreen mode

For Windows:
Open your php.ini file.Uncomment the line ;extension=intl by removing the semicolon (;).
extension=intl

Restart Your Web Server

After installing or enabling the intl extension, restart your web server to apply the changes.
For Apache:



sudo service apache2 restart


Enter fullscreen mode Exit fullscreen mode

For Nginx:



sudo service nginx restart
sudo service php-fpm restart


Enter fullscreen mode Exit fullscreen mode

Check Installation:

You can verify if the extension is enabled by running:



php -m | grep intl


Enter fullscreen mode Exit fullscreen mode

If intl is listed, then the extension is enabled.

Composer Update:

Make sure your Composer dependencies are up to date.



composer update


Enter fullscreen mode Exit fullscreen mode

After performing these steps, the NumberFormatter class should be available in your Laravel project. If the problem persists, make sure your PHP configuration is correctly pointing to the right php.ini file, and check for any typos or errors in your configuration files.


See Also

Fixing Unresolvable Dependency Injection Errors in Laravel

Laravel Collection.php Error: Causes and Solutions

Fixing Laravel 'Could Not Find Driver' Error: A Quick Guide

Laravel Image Upload Not Showing? How to Fix It

Top comments (0)