What’s the difference between "require" and "require-dev"?

Asked

Viewed 425 times

4

In the Composer, Grunt for example, has the require and the require-dev. My question is what’s the difference between them?

Example phpBB

"require": {
    "php": ">=5.3.3,<7.0",
    "lusitanian/oauth": "0.2.*",
    "symfony/config": "2.3.*",
    "symfony/console": "2.3.*",
    "symfony/dependency-injection": "2.3.*",
    "symfony/event-dispatcher": "2.3.*",
    "symfony/http-kernel": "2.3.*",
    "symfony/routing": "2.3.*",
    "symfony/yaml": "2.3.*",
    "twig/twig": "1.*"
},
"require-dev": {
    "fabpot/goutte": "1.0.*",
    "phing/phing": "2.4.*",
    "phpunit/dbunit": "1.3.*",
    "phpunit/phpunit": "4.1.*",
    "sami/sami": "1.*",
    "squizlabs/php_codesniffer": "2.*",
    "symfony/browser-kit": "2.3.*",
    "symfony/css-selector": "2.3.*",
    "symfony/debug": "2.3.*",
    "symfony/dom-crawler": "2.3.*",
    "symfony/filesystem": "2.3.*",
    "symfony/finder": "2.3.*",
    "symfony/http-foundation": "2.3.*",
    "symfony/process": "2.3.*"
}

2 answers

2


The list of packages in the key require contains the essential packages for your project, which must be installed in any of the environments (production, approval, tests etc.) in which it will run. The command composer install install these packages.

Already the list of packages in the key require-dev contains only packages that must be installed in development environment, and are installed using the command composer install --dev. You should avoid installing these packages in production environment since, since they should never be used in this type of environment, they end up adding unnecessary files to the project.

1

Taking this into account. The packages require-dev are not required for your project to work and should not be included in the version that goes into production. These convention packages are for development and testing only.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.