Closed gadget00 closed 5 years ago
First step: Extract the steps necessary to reproduce the issue in isolation and add that to your question here. Keep in mind that nobody here knows what code is running on your machine. Then, also read the release notes with changes between the two PHP versions. Further, what versions of moneyphp/money
are we talking about?
@gadget00 the issue you describe sound like you are missing the php7.2-intl
extension package.
Thanks for the orientation; Im using the 3.2 version, that was downloaded through composer
.
I'm using a simple variation of the same example code that is shown in the documentation:
use Money\Currencies\ISOCurrencies;
use Money\Currency;
use Money\Formatter\IntlMoneyFormatter;
use Money\Money;
$money = new Money(100, new Currency('PAB'));
$currencies = new ISOCurrencies();
//THIS LINE is what throws the error
$numberFormatter = new \NumberFormatter('es_PA', \NumberFormatter::CURRENCY);
$moneyFormatter = new IntlMoneyFormatter($numberFormatter, $currencies);
$total_cash = $moneyFormatter->format($money);
I had no idea about changes between the two PHP versions. At least that is not pointed out in the official documentation. I'll go and seek that additional documentation
@gadget00 the issue you describe sound like you are missing the
php7.2-intl
extension package.
thats great; how do I install it?
I saw it was a "suggestion" by composer but didnt knew how to add it
@gadget00 the issue you describe sound like you are missing the
php7.2-intl
extension package.thats great; how do I install it?
I saw it was a "suggestion" by composer but didnt knew how to add it
Oh, I just saw is a PHP additional module. I´ll use my package manager to install it then.
Have to say, the documentation wasn't clear enough about the "intl
extension" been a PHP additional package, and not a PHP composer library .
I will test it and confirm; thank you
@gadget00 on linux Debian or Ubuntu, it should be something like apt-get install php7.2-intl
I can confirm that my PHP 7.2-19 installation was missing thephp7.2-intl
extension, and that was the cause of the problem. I installed it through my linux package manager, restarted the apache service and now it is working fine.
I'll proceed to close this issue. Great work!
I just want to say: it's absolutely amazing to see the community helping out on an issue tracker! Kudos to everyone!
@gadget00 on linux Debian or Ubuntu, it should be something like
apt-get install php7.2-intl
I can verify that this solved the issue for me ("apt-install php7.4-intl", in my case)
On my webserver using PHP 7.2-19, I can't manage to run my code because I keep getting the error of an unrecognized '
NumberFormatter
' class. I removed a reinstalled with composer a few times, and tested another formatters like theDecimalMoneyFormatter
and because it doesn't require an instance ofNumberFormatter
, that one works Ok.However, locally in my laptop using PHP 5.6.36 the
NumberFormatter
class is detected correctly and theIntlMoneyFormatter
works flawlessly.What can I check or consider, in order to fix this issue? I dont want to downgrade my whole webserver installation due to this; it must be some detail I am missing out I guess.
Please help; thanks