0

I just installed symfony and symfony flex via composer require symfony/flex but symfony flex aliases don't work. For example, when I try to install twig by doing composer require twig, I receive this answer :

Info from https://repo.packagist.org: #StandWithUkraine

[InvalidArgumentException]
Could not find package twig.

Did you mean one of these?
twig/twig
latte/latte
slim/twig-view
twig/extensions
twig/intl-extra

require [--dev] [--dry-run] [--prefer-source] [--prefer-dist] [--prefer-install PREFER-INSTALL] [--fixed] [--no-suggest] [--no-progress] [--no-update] [--no-install] [--no-scripts] [- -update-no-dev] [-w|--update-with-dependencies] [-W|--update-with-all-dependencies] [--with-dependencies] [--with-all-dependencies] [--ignore-platform-req IGNORE-PLATFORM-REQ] [--igno re-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--apcu-autoloader-prefix APCU-AUT OLOADER-PREFIX] [--] []...

How can I solve this problem ?

  • Did you try minimum-stability to dev in composer.json ? – DLK Jul 18 '22 at 14:30
  • No, what do I have to change in the composer.json file ? – user11955929 Jul 18 '22 at 14:37
  • So what motivated you to install symfony/flex? Are you trying to update an old version of symfony? If not then be aware the flex is installed automatically. You really don't need to do anything. And while I don't enjoy being unkind, I suspect that some of the other folks trying to help you don't actually know what flex is. – Cerad Jul 18 '22 at 15:07
  • I want to use symfony because I don't want to write recipes myself everytime I install a package, such as annotations, twig or whatever else. Plus, I like the alias option. – user11955929 Jul 18 '22 at 15:11
  • Right but if you created a Symfony app using the standard procedures then flex is installed automatically. Something like `symfony new --full my_app`. Looks like you have something else going on. – Cerad Jul 18 '22 at 15:44
  • I just did an installation with --full and the installation was longer but I'm still unable to use aliases. – user11955929 Jul 18 '22 at 17:00
  • What are your PHP and composer versions? Just out of curiosity I made an empty directory and did a `composer require symfony/flex` followed by `composer require twig` and somewhat to my surprise it completed without errors. Not sure what it actually did or how useful it would be without the framework but it did something. I have composer 2.3.8 installed along with PHP 8.1. – Cerad Jul 18 '22 at 17:07
  • The problem came from my composer version. I upgraded it and now it works fine. Thank you very much. – user11955929 Jul 18 '22 at 18:41

1 Answers1

1

The problem came from my composer version, once it was upgraded, the symfony flex aliases worked.