title: Composer scripts disregards Symfony console environment variable
body: <p>I am facing an issue where the build process of my Symfony application fails, as explained in many different forums (none recent). For instance:</p>
  
  <blockquote>
    <p>When doing composer install with --no-dev only the production packages
    are installed (as it should be). However when composer launches the
    symfony scripts they are launched in development modes and thus start
    throwing errors when AppKernel.php can not find packages needed for
    development. These scripts should also be executed in production mode!</p>
  </blockquote>
  
  <p><a href="https://github.com/symfony/symfony/issues/11704" rel="nofollow noreferrer">Quote source</a></p>
  
  <p>The above Github issue is closed, as it apparently can be fixed by setting the <code>SYMFONY_ENV</code> env variable to the environment of your choice: <code>export SYMFONY_ENV=prod</code>.</p>
  
  <p>I have done that, and calling <code>printenv</code> correctly prints the variable. I can even call the Symfony console <code>php bin/console</code> manually. and it <em>will</em> launch in <code>prod</code> environment. </p>
  
  <p>Success? Seemingly, but no... Calling <code>composer install</code> still forces all scripts to launch in <code>dev</code> environment. What gives?</p>