I want my currency to ignore decimal value, so far I have this:
main.php:
'formatter' => [
'class' => 'yii\i18n\Formatter',
'thousandSeparator' => '.',
'decimalSeparator' => ',',
'currencyCode' => '€',
],
view:
[
'attribute' => 'Score',
'format' => 'currency',
],
Any idea on how to move forward?
In main.php:
Be sure that php_intl extensions is installed. It works for me.
Link to the documentation yii-i18n-formatter.
The manual on
currencyCode
:Try setting
currencyCode
to'EUR'
(though that doesn't seem to be that important) and put the formatter in an arrayThis requires the PHP intl extension to be installed. Status of the extension can be tested by calling
extension_loaded('intl')
. In absence of the extension, your best bet is probably to write a custom formatter.Use it instead of the default formatter an then call it like this:
This also allows you to freely set the currency symbol.