number_format (php) in volt

Hello! How in the Volt output format a number with a partition of the groups (1000 -> 1 000)?

edited Mar '17


First, you need to register a filter (see

$compiler->addFilter('number_format', 'number_format');

Then you need to call this filter like this:

{{  1000|number_format(0, '.', ' ') }}

NOTE: Use those arguments for number_format that are necessary for your task (see

edited Mar '17

Thank you. Where should I register the filter? In service.php or in the controller? While I receive an error Unknown filter "number_format"

Where you define view service.

edited Mar '17

Registered in service.php in protected function initSharedVolt