formatter as currency, add space after dollar sign ?

<?= Yii::$app->formatter->asCurrency(100); ?> 

shows "$100". I want it to have spaces between $ and 100. e.g. "$ 100"

How can I do that ?

any idea ?

Yii wrap php class for formatting numbers

This is the ICU way to format en_us currency.

I looked at manual and I think there is nothing about adding space between currency symbol and the value.

Try to check yourself the PHP manual maybe I missed something.

Sorry for not being more useful.

I know this is an old post, but you need to extend the \yii\i18n\Formatter class add the following to the createNumberFormatter method:
$formatter->setPattern( str_replace('¤#','¤ #', $formatter->getPattern() ) );

The result should look like the following:

protected function createNumberFormatter($style, $decimals = null, $options = [], $textOptions = []) {
        $formatter = parent::createNumberFormatter($style, $decimals, $options, $textOptions);

        $formatter->setPattern( str_replace('¤#','¤ #', $formatter->getPattern() ) );

        return $formatter;

Then configure the formatter component in your config files to point to this new class.

Hope this helps!