chx
chx

Reputation: 11760

composer install --dev is gone, how do I use dev dependencies?

  1. Most people in my team doesn't need dev dependencies. So it is desirable that composer install doesn't install dev dependencies.
  2. However, QA does need to install them with some command.

I have no idea how to achieve this now. Formerly it was composer install --dev but that's gone.

Upvotes: 6

Views: 9088

Answers (1)

Nicolai Fröhlich
Nicolai Fröhlich

Reputation: 52493

You can set the environment variable COMPOSER_NO_DEV to 0 or 1 to change the default behaviour of composer install and composer update.

see: documentation - COMPOSER_NO_DEV

  • If you want composer install to not install the dev dependencies by default
    • export COMPOSER_NO_DEV=1
  • If you want composer install to install dev dependencies (the default)
    • export COMPOSER_NO_DEV=0
    • or unset COMPOSER_NO_DEV

Depending on how you develop (i.e. in a container) there are various options to set a default value for the environment variable.

On the other hand you can instruct your engineer colleagues that do not require any dev dependencies to run the command:

composer install --no-dev

# .. or ..
COMPOSER_NO_DEV=1 composer install

... instead of ...

composer install

# .. or ..
COMPOSER_NO_DEV=0 composer install

Upvotes: 6

Related Questions