PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, January 23, 2022

[FIXED] Twig Error Unknown "format_number" filter on Symfony 4 project

 January 23, 2022     symfony, symfony4, twig, twig-filter     No comments   

Issue

format_number was introduced in 2.12, as far as I can tell I have 2.13, using {{ constant('Twig_Environment::VERSION') }} outputs The current version is 2.13.0

Here is my composer json, I just dont see a reason I should be getting an unknown filter in this symfony 4.4.* project.

"require": {
        "php": "^7.1.3",
        "ext-ctype": "*",
        "ext-iconv": "*",
        "ext-json": "*",
        "beberlei/doctrineextensions": "^1.2",
        "friendsofsymfony/jsrouting-bundle": "^2.3",
        "sensio/framework-extra-bundle": "^5.4",
        "symfony/asset": "4.4.*",
        "symfony/console": "4.4.*",
        "symfony/dotenv": "4.4.*",
        "symfony/flex": "^1.3.1",
        "symfony/form": "4.4.*",
        "symfony/framework-bundle": "4.4.*",
        "symfony/orm-pack": "^1.0",
        "symfony/security-bundle": "4.4.*",
        "symfony/swiftmailer-bundle": "^3.2",
        "symfony/twig-bridge": "4.*",
        "symfony/twig-bundle": "4.4.*",
        "symfony/validator": "4.4.*",
        "symfony/web-server-bundle": "4.4.*",
        "symfony/yaml": "4.4.*",
        "twig/twig": "2.*"
    },

Solution

format_number filter is not part of the main twig/twig package. You need the Twig Extra package/bundle which you can install with:

composer require twig/extra-bundle


Answered By - Edi Modrić
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing