composer-php

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


Most people in my team don't need dev dependencies. So it is desirable that composer install doesn't install dev dependencies.

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 emitting a deprecated warning:

# composer install --dev
You are using the deprecated option "--dev".
It has no effect and will break in Composer 3.

Solution

  • 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

    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