Search code examples
phpcomposer-phpsymfony4

Testing Symfony flex on Windows


I can't make composer working with flex receipe on a symfony4 project, on Windows.

Here is the complete process :

  • I installed PHP7.2 from http://windows.php.net/download#php-7.2 (VC15 x86 Non Thread Safe), PATH env is set. php.ini is created (from php.ini-development). PHP is working on windows (php -v).
  • I installed composer from the Composer-Setup.exe (https://getcomposer.org/download/). It changed the php.ini for me for activating some php extensions (openssl, etc).
  • I created a project with composer create-project symfony/skeleton sf4
  • I moved to sf4 dir : cd C:/sf4
  • I run Web Server : php -S 127.0.0.1:8000 -t public
  • It works when I browse locahost:8000
  • So I want to install the symfony twig bundle as a flex package : composer require twig

The error I get :

 [InvalidArgumentException]
  Could not find package twig.

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

I tried with a local composer.phar inside the sf4 project :

cd C:/sf4
php composer.phar require twig

=> same error

Composer seems to ignore flex plugin, do you have any idea ? Thx !


Solution

  • see the answer of nicolas-grekas in the following link

    you can continue using the symfony containers in this link, just look for the alias that flex used.

    in your case twig for flex is "symfony / twig-bundle", run composer req symfony / twig-bundle.

    salu2