§ tags: phpsymfony2twig

  1. create kernel event listener

  2. modify onKernelRequest:

<?php

namespace Acme\DemoBundle\EventListener;

use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;

class AcmeKernelListener
{
    protected $container;

    public function __construct(ContainerInterface $container)
    {
        $this->container = $container;
    }

    public function onKernelRequest(GetResponseEvent $event)
    {
        $this->container->get('twig')->getExtension('core')->setNumberFormat(2, '.', '');
    }
}
  1. using number_format in twig