"Class 'NumberFormatter' not found error".
diusazzad opened this issue · comments
I encountered an error while accessing the edit.blade.php view in the laravel-crm package. The error message is as follows:
Preconditions:
Framework Version: Laravel 9.52.15
Access the page at http://127.0.0.1:8000/admin/leads/create
Expected Result:
The page should load without any errors.
Actual Result:
The error message "Class 'NumberFormatter' not found" is displayed.
Additional Information:
PHP Version: 8.1.12
Laravel Locale: en
Laravel Config Cached: false
App Debug: true
App Env: local
Code Snippet:
/**
- Format price with base currency symbol.
- @param float $price
- @return string
*/
public function currencySymbol($code)
{
$formatter = new \NumberFormatter(app()->getLocale() . '@Currency=' . $code, \NumberFormatter::CURRENCY);
return $formatter->getSymbol(\NumberFormatter::CURRENCY_SYMBOL);
}
Browser and Request Information:
Browser: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
Request URL: http://127.0.0.1:8000/admin/leads/create
User and Versions Information:
User: Example Admin (admin@example.com)
Php Version: 8.1.12
Laravel Version: 9.52.15
please, enable extension intl in php.ini file to fix this problem
apt-get install php7.x-intl <---- + restart apache -> will solve your issues
after installing the extension, it should work.
closing it.