3

I tried installing the twig/extensions package in it's dev-master version in my Symfony 5 application. I am meeting the following output :

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for twig/extensions dev-master -> satisfiable by twig/extensions[dev-master].
    - Conclusion: remove twig/twig v3.0.3
    - Conclusion: don't install twig/twig v3.0.3
    - twig/extensions dev-master requires twig/twig ^2.10 -> satisfiable by twig/twig[v2.10.0, v2.11.0, v2.11.1, v2.11.2, v2.11.3, v2.12.0, v2.12.1, v2.12.2, v2.12.3, v2.12.4, v2.12.5].
    - Can only install one of: twig/twig[v2.10.0, v3.0.3].
    - Can only install one of: twig/twig[v2.11.0, v3.0.3].
    - Can only install one of: twig/twig[v2.11.1, v3.0.3].
    - Can only install one of: twig/twig[v2.11.2, v3.0.3].
    - Can only install one of: twig/twig[v2.11.3, v3.0.3].
    - Can only install one of: twig/twig[v2.12.0, v3.0.3].
    - Can only install one of: twig/twig[v2.12.1, v3.0.3].
    - Can only install one of: twig/twig[v2.12.2, v3.0.3].
    - Can only install one of: twig/twig[v2.12.3, v3.0.3].
    - Can only install one of: twig/twig[v2.12.4, v3.0.3].
    - Can only install one of: twig/twig[v2.12.5, v3.0.3].
    - Installation request for twig/twig (locked at v3.0.3) -> satisfiable by twig/twig[v3.0.3].

As the package page seems to require twig/twig in its version ^2.10 I tried to find it there was a package requiring something conflictual in my project (for instance ^3.0) but there do not seems to exist one :

$ composer why twig/twig
knplabs/knp-paginator-bundle  v5.1.1  requires  twig/twig (^2.0 || ^3.0)
symfony/twig-bridge           v5.0.4  requires  twig/twig (^2.10|^3.0)
symfony/twig-bundle           v5.0.4  requires  twig/twig (^2.10|^3.0)
symfony/twig-pack             v1.0.0  requires  twig/twig (^2.12|^3.0)
symfony/web-profiler-bundle   v5.0.4  requires  twig/twig (^2.10|^3.0)
twig/extra-bundle             v3.0.3  requires  twig/twig (^2.4|^3.0)

Could someone enlighten me on why Composer can't resolve my requirements ? Don't hesitate to ask for the output of more comments. I'll edit this accordingly.

Here the require and require-dev keys of my composer.json :

"require": {
    "php": "^7.2.5",
    "ext-ctype": "*",
    "ext-iconv": "*",
    "antishov/doctrine-extensions-bundle": "^1.4",
    "knplabs/knp-paginator-bundle": "^5.1",
    "sensio/framework-extra-bundle": "^5.1",
    "symfony/asset": "5.0.*",
    "symfony/console": "5.0.*",
    "symfony/dotenv": "5.0.*",
    "symfony/expression-language": "5.0.*",
    "symfony/flex": "^1.3.1",
    "symfony/form": "5.0.*",
    "symfony/framework-bundle": "5.0.*",
    "symfony/http-client": "5.0.*",
    "symfony/intl": "5.0.*",
    "symfony/mailer": "5.0.*",
    "symfony/monolog-bundle": "^3.1",
    "symfony/notifier": "5.0.*",
    "symfony/orm-pack": "*",
    "symfony/process": "5.0.*",
    "symfony/security-bundle": "5.0.*",
    "symfony/serializer-pack": "*",
    "symfony/string": "5.0.*",
    "symfony/translation": "5.0.*",
    "symfony/twig-pack": "*",
    "symfony/validator": "5.0.*",
    "symfony/web-link": "5.0.*",
    "symfony/webpack-encore-bundle": "^1.7",
    "symfony/yaml": "5.0.*"
},
"require-dev": {
    "doctrine/doctrine-fixtures-bundle": "^3.3",
    "fzaninotto/faker": "^1.9",
    "symfony/debug-pack": "*",
    "symfony/maker-bundle": "^1.0",
    "symfony/profiler-pack": "*",
    "symfony/test-pack": "*"
}
Altherius
  • 754
  • 7
  • 23

4 Answers4

2

Looks like your twig extensions package has been pretty much abandoned!

From packagist:

requires: twig/twig: ^1.27|^2.0

and on the dev-master branch:

requires: twig/twig: ^2.10

Sorry amigo! https://packagist.org/packages/twig/extensions#dev-master

delboy1978uk
  • 12,118
  • 2
  • 21
  • 39
2

That extensions package is only compatible with Twig up to v2, but you already have v3 installed. If you explicitly want to use an "older" Twig version (there's nothing wrong in that), require it through composer require twig/twig "^2.10". Afterwards, you can install that extensions package without any problem.

If you want to stay up-to-date, have a look at https://github.com/twigphp/Twig-extensions. That extensions package is deprecated, but got split up into components. Depending on which part you need, you can install them from other sources

Nico Haase
  • 11,420
  • 35
  • 43
  • 69
2

This package is abandoned in favor of twig/extra-bundle, you will find all twig extensions you need there. For Symfony 4 and 5 do not forget to enable extensions you need in services.xml like this:

services:
    Twig\Extra\Intl\IntlExtension: null
0

try simply :"composer require twig/intl-extra" this runs for me

  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Aug 03 '22 at 08:41